Skip Menu |

This queue is for tickets about the Parse-Dia-SQL CPAN distribution.

Report information
The Basics
Id: 91448
Status: resolved
Priority: 0/
Queue: Parse-Dia-SQL

People
Owner: Nobody in particular
Requestors: felix.ostmann [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.25
Fixed in: (no value)



Subject: BIGSERIAL / BIGINT in PostgreSQL
There is a special case for serial -> int4 already, but in PostgreSQL there is also bigserial that match to int8. Attached a patch with test.
Subject: Parse-Dia-SQL-0.25.bigserial.patch
diff -r -u Parse-Dia-SQL-0.25.orig/lib/Parse/Dia/SQL/Utils.pm Parse-Dia-SQL-0.25/lib/Parse/Dia/SQL/Utils.pm --- Parse-Dia-SQL-0.25.orig/lib/Parse/Dia/SQL/Utils.pm 2012-07-24 09:13:55.000000000 +0200 +++ Parse-Dia-SQL-0.25/lib/Parse/Dia/SQL/Utils.pm 2013-12-09 17:49:17.948002275 +0100 @@ -549,7 +549,7 @@ $self->{log}->info(qq{Replaced $typeName with smallint}) if $self->{log}->is_info(); return 'smallint'; } - if ( lc($typeName) eq 'int8' ) { + if ( lc($typeName) eq 'bigserial' or lc($typeName) eq 'int8' ) { $self->{log}->info(qq{Replaced $typeName with bigint}) if $self->{log}->is_info(); return 'bigint'; } diff -r -u Parse-Dia-SQL-0.25.orig/t/703-utils-get-base-name.t Parse-Dia-SQL-0.25/t/703-utils-get-base-name.t --- Parse-Dia-SQL-0.25.orig/t/703-utils-get-base-name.t 2011-02-15 21:11:10.000000000 +0100 +++ Parse-Dia-SQL-0.25/t/703-utils-get-base-name.t 2013-12-09 17:49:30.300001824 +0100 @@ -8,7 +8,7 @@ use File::Spec::Functions; use lib catdir qw ( blib lib ); -plan tests => 7; +plan tests => 8; use lib q{lib}; use_ok ('Parse::Dia::SQL::Utils'); @@ -22,6 +22,7 @@ is($utils->get_base_type('int4', 'postgres'), 'integer'); is($utils->get_base_type('serial', 'postgres'), 'integer'); is($utils->get_base_type('int8', 'postgres'), 'bigint'); +is($utils->get_base_type('bigserial', 'postgres'), 'bigint'); is($utils->get_base_type('int2', 'mysql-myisam'), 'int2');
From: felix.ostmann [...] gmail.com
Am Mo 16. Dez 2013, 09:40:41, felix.ostmann@gmail.com schrieb: Show quoted text
> There is a special case for serial -> int4 already, but in PostgreSQL > there is also bigserial that match to int8. > > Attached a patch with test.
Btw. there is also a smallserial ... i should have added that too :-/ my fault ... see here: http://www.postgresql.org/docs/9.3/static/datatype-numeric.html
Merged 39cb2e4e into 0.26. Thanks.