Added semi-colon for (DROP|CREATE) TYPE statements in the Pg producer (wreis)
Ash Berlin [Mon, 16 Mar 2009 23:59:52 +0000 (23:59 +0000)]
Changes
lib/SQL/Translator/Producer/PostgreSQL.pm

diff --git a/Changes b/Changes
index f38dd30..a8c17e7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@
 # x.xxxxx xxxx-xx-xx
 # ----------------------------------------------------------
 * Properly quote absolute table names in the MySQL producer
+* Added semi-colon for (DROP|CREATE) TYPE statements in the Pg producer (wreis)
 
 # ----------------------------------------------------------
 # 0.09004 2009-02-13
index d778af4..a291bfc 100644 (file)
@@ -403,14 +403,14 @@ sub create_table
     if ($add_drop_table) {
         if ($postgres_version >= 8.2) {
             $create_statement .= qq[DROP TABLE IF EXISTS $qt$table_name_ur$qt CASCADE;\n];
-            $create_statement .= join ("\n", @type_drops) . "\n"
-                if $postgres_version >= 8.3;
+            $create_statement .= join (";\n", @type_drops) . ";\n"
+                if $postgres_version >= 8.3 && scalar @type_drops;
         } else {
             $create_statement .= qq[DROP TABLE $qt$table_name_ur$qt CASCADE;\n];
         }
     }
-    $create_statement .= join("\n", @type_defs) . "\n"
-        if $postgres_version >= 8.3;
+    $create_statement .= join(";\n", @type_defs) . ";\n"
+        if $postgres_version >= 8.3 && scalar @type_defs;
     $create_statement .= qq[CREATE ${temporary}TABLE $qt$table_name_ur$qt (\n].
                             join( ",\n", map { "  $_" } @field_defs, @constraint_defs ).
                             "\n)"