- Alexander Hartmaier <abraxxa@cpan.org>
- Allen Day <allenday@users.sourceforge.net>
+- Amiri Barksdale <amiri@roosterpirates.com>
- Anders Nor Berle <berle@cpan.org>
- Andrew Moore <amoore@cpan.org>
+- Andrew Pam <andrew.pam@strategicdata.com.au>
- Arthur Axel "fREW" Schmidt <frioux@gmail.com>
- Ben Faga <faga@cshl.edu>
- Cedric Carree <beg0@free.fr>
- Vincent Bachelier <geistteufel@yahoo.fr>
- Wallace Reis <wreis@cpan.org>
- Ying Zhang <zyolive@yahoo.com>
-- Amiri Barksdale <amiri@roosterpirates.com>
If you would like to contribute to the project, you can send patches
to the developers mailing list:
my $schema = $tr->schema;
my $column_select = $dbh->prepare(
- "SELECT a.attname, t.typname, a.attnum,a.atttypmod as length,
- a.attnotnull, a.atthasdef, d.adsrc
+ "SELECT a.attname, format_type(t.oid, a.atttypmod) as typname, a.attnum,
+ a.atttypmod as length, a.attnotnull, a.atthasdef, d.adsrc
FROM pg_type t,pg_attribute a
LEFT JOIN pg_attrdef d ON (d.adrelid = a.attrelid AND a.attnum = d.adnum)
WHERE a.attrelid=? AND attnum>0
order => $$columnhash{'attnum'},
) || die $table->error;
- $col->{size} = [$$columnhash{'length'}] if $$columnhash{'length'}>0;
+ $col->{size} = [$$columnhash{'length'}]
+ if $$columnhash{'length'}>0 && $$columnhash{'length'}<=0xFFFF;
$col->{is_nullable} = $$columnhash{'attnotnull'} ? 0 : 1;
}
create table sqlt_test1 (
f_serial serial NOT NULL primary key,
- f_varchar character varying (255),
+ f_varchar character varying(255),
f_text text default 'FOO'
);
my $f1 = shift @t1_fields;
is( $f1->name, 'f_serial', 'First field is "f_serial"' );
-#FIXME: it should better be 'INTEGER' instead of 'int4'
-is( $f1->data_type, 'int4', 'Field is an integer' );
+is( $f1->data_type, 'integer', 'Field is an integer' );
is( $f1->is_nullable, 0, 'Field cannot be null' );
is( $f1->default_value, "nextval('sqlt_test1_f_serial_seq'::regclass)", 'Default value is nextval()' );
is( $f1->is_primary_key, 1, 'Field is PK' );
my $f2 = shift @t1_fields;
is( $f2->name, 'f_varchar', 'Second field is "f_varchar"' );
-is( $f2->data_type, 'varchar', 'Field is a varchar' );
+is( $f2->data_type, 'character varying(255)', 'Field is a character varying(255)' );
is( $f2->is_nullable, 1, 'Field can be null' );
#FIXME: should not be 255?
is( $f2->size, 259, 'Size is "259"' );
my $t2_f1 = shift @t2_fields;
is( $t2_f1->name, 'f_id', 'First field is "f_id"' );
-is( $t2_f1->data_type, 'int4', 'Field is an integer' );
+is( $t2_f1->data_type, 'integer', 'Field is an integer' );
is( $t2_f1->is_nullable, 0, 'Field cannot be null' );
is( $t2_f1->size, 0, 'Size is "0"' );
is( $t2_f1->default_value, undef, 'Default value is undefined' );
my $t2_f2= shift @t2_fields;
is( $t2_f2->name, 'f_int', 'Third field is "f_int"' );
-is( $t2_f2->data_type, 'int2', 'Field is an integer' );
+is( $t2_f2->data_type, 'smallint', 'Field is an smallint' );
is( $t2_f2->is_nullable, 1, 'Field can be null' );
is( $t2_f2->size, 0, 'Size is "0"' );
is( $t2_f2->default_value, undef, 'Default value is undefined' );
my $t2_f3 = shift @t2_fields;
is( $t2_f3->name, 'f_fk1', 'Third field is "f_fk1"' );
-is( $t2_f3->data_type, 'int4', 'Field is an integer' );
+is( $t2_f3->data_type, 'integer', 'Field is an integer' );
is( $t2_f3->is_nullable, 0, 'Field cannot be null' );
is( $t2_f3->size, 0, 'Size is "0"' );
is( $t2_f3->default_value, undef, 'Default value is undefined' );