Subject: | Producer::PostgreSQL types without size |
There were many missing. I rewrote it to add the size to the ones listed
in http://postgresql.com.cn/docs/8.3/static/datatype.html.
Patch attached.
Subject: | sqltpg.diff |
--- /Library/Perl/5.8.8/SQL/Translator/Producer/PostgreSQL.pm 2008-04-26 11:41:13.000000000 +0200
+++ lib/SQL/Translator/Producer/PostgreSQL.pm 2008-04-26 12:14:59.000000000 +0200
@@ -631,14 +631,16 @@
$data_type = 'integer';
}
}
- my @type_without_size = qw/bigint boolean box bytea cidr circle date inet
- integer smallint text line lseg macaddr money
- path point polygon real/;
- foreach (@type_without_size) {
+ my @type_with_size = qw/bit varbit character/;
+ push(@type_with_size, "bit varying", "character varying");
+ # see http://postgresql.com.cn/docs/8.3/static/datatype.html for more
+ my $with_size = 0;
+ foreach (@type_with_size) {
if ( $data_type =~ qr/$_/ ) {
- undef @size; last;
+ $with_size = 1;
}
}
+ return $data_type unless $with_size;
if ( defined $size[0] && $size[0] > 0 ) {
$data_type .= '(' . join( ',', @size ) . ')';