From: Peter Rabbitson Date: Sat, 3 Oct 2009 18:08:31 +0000 (+0000) Subject: Fix RT49301 X-Git-Tag: v0.11008~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3bddac946a236e1876c6cc414adc01c5ab8694a;p=dbsrgits%2FSQL-Translator.git Fix RT49301 --- diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index ae37a83..b89c0d0 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -702,7 +702,7 @@ sub convert_datatype my $type_with_size = join('|', 'bit', 'varbit', 'character', 'bit varying', 'character varying', - 'time', 'timestamp', 'interval' + 'time', 'timestamp', 'interval', 'numeric' ); if ( $data_type !~ /$type_with_size/ ) { diff --git a/t/46xml-to-pg.t b/t/46xml-to-pg.t index dcdb01f..e1796df 100644 --- a/t/46xml-to-pg.t +++ b/t/46xml-to-pg.t @@ -54,6 +54,7 @@ CREATE INDEX "titleindex" on "Basic" ("title"); DROP TABLE "Another" CASCADE; CREATE TABLE "Another" ( "id" serial NOT NULL, + "num" numeric(10,2), PRIMARY KEY ("id") ); diff --git a/t/47postgres-producer.t b/t/47postgres-producer.t index 55d3e17..ec31cd6 100644 --- a/t/47postgres-producer.t +++ b/t/47postgres-producer.t @@ -14,7 +14,7 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(24, + maybe_plan(25, 'SQL::Translator::Producer::PostgreSQL', 'Test::Differences', ) @@ -113,6 +113,16 @@ is( 'Create time field without time zone but with size, works' ); +my $field_num = SQL::Translator::Schema::Field->new( name => 'num', + table => $table, + data_type => 'numeric', + size => [10,2], + ); +my $fieldnum_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_num); + +is($fieldnum_sql, 'num numeric(10,2)', 'Create numeric field works'); + + my $field4 = SQL::Translator::Schema::Field->new( name => 'bytea_field', table => $table, data_type => 'bytea',