Added patch from wreis, view support for pg producer
[dbsrgits/SQL-Translator.git] / t / 46xml-to-pg.t
index 7bb025f..e3b3540 100644 (file)
@@ -33,7 +33,7 @@ my $sql = $sqlt->translate(
 ) or die $sqlt->error;
 
 is($sql, << "SQL");
-DROP TABLE "Basic";
+DROP TABLE "Basic" CASCADE;
 CREATE TABLE "Basic" (
   "id" serial NOT NULL,
   "title" character varying(100) DEFAULT 'hello' NOT NULL,
@@ -43,9 +43,26 @@ CREATE TABLE "Basic" (
   "explicitemptystring" character varying DEFAULT '',
   -- Hello emptytagdef
   "emptytagdef" character varying DEFAULT '',
+  "another_id" integer DEFAULT '2',
   "timest" timestamp(0),
   PRIMARY KEY ("id"),
   Constraint "emailuniqueindex" UNIQUE ("email")
 );
 CREATE INDEX "titleindex" on "Basic" ("title");
+
+
+DROP TABLE "Another" CASCADE;
+CREATE TABLE "Another" (
+  "id" serial NOT NULL,
+  PRIMARY KEY ("id")
+);
+
+
+
+CREATE OR REPLACE VIEW "email_list" ( "email" ) AS (
+    SELECT email FROM Basic WHERE email IS NOT NULL
+  );
+
+ALTER TABLE "Basic" ADD FOREIGN KEY ("another_id")
+  REFERENCES "Another" ("id") DEFERRABLE;
 SQL