From: Ash Berlin Date: Mon, 16 Mar 2009 23:59:52 +0000 (+0000) Subject: Added semi-colon for (DROP|CREATE) TYPE statements in the Pg producer (wreis) X-Git-Tag: v0.11008~219 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=938464eedb3957c058c18635aefac08188da4263;p=dbsrgits%2FSQL-Translator.git Added semi-colon for (DROP|CREATE) TYPE statements in the Pg producer (wreis) --- diff --git a/Changes b/Changes index f38dd30..a8c17e7 100644 --- 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 diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index d778af4..a291bfc 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -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)"