DBD::Pg 1.32 test release available

scott at ruralnetwork.net scott at ruralnetwork.net
Tue Mar 2 15:27:30 PST 2004


Using the Pg 1.32 offical release I was able to make some progress. I did 
run into another problem, however. 

When following migration the steps for going from Freesidide 1.31 to 
Freeside 1.40, there is the step:
 run bin/create-history-tables username 

Running this gives errors like: 

DBD::Pg::db do failed: ERROR:  pg_atoi: error in "'0'": can't parse "'0'" at 
bin/create-history-tables line 81.
CREATE error: ERROR:  pg_atoi: error in "'0'": can't parse "'0'" 

when it attempts to set the default value of int4 types to '''0'''', and 
similar values for the numeric and float8 types. 

If I hack the DBIx::DBSchema 0.23 a bit and modify the line() function of 
Column.pm and add a couple of lines to the driver hack section : 

 #this should be a callback into the driver
 if ( $driver eq 'mysql' ) { #yucky mysql hack
   $null ||= "NOT NULL";
   $self->local('AUTO_INCREMENT') if uc($self->type) eq 'SERIAL';
 } elsif ( $driver eq 'Pg' ) { #yucky Pg hack
   $null ||= "NOT NULL";
   $null =~ s/^NULL$//; 

+    if ($type =~ /(int4|numeric|float8)$/i) {
+        if ($default =~ /\'+/) {
+                        $default = $self->default;
+        }
   }
 } 

It seems to give the desired behavior.  I was lead on to this trail by some 
discussions I read like this one
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=20040216164223.60 
587.qmail%40web13810.mail.yahoo.com&rnum=3&prev=/groups%3Fq%3Dpg_atoi%2Bchan 
ged%2BOR%2Bchanges%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D20040216164223.60 
587.qmail%2540web13810.mail.yahoo.com%26rnum%3D3
about changes to modern versions of Postgresql 

And my system is running: 

DBIx::DBSchema 0.23
DBI 1.41
Freeside 1.4.1
Postgresql 7.3.4
Perl v5.8.1
Mandrake 9.2 

Regards, 

Scott Langley
scott at ruralnetwork.net
Systems Administrator
Rural Network Services



More information about the freeside-users mailing list