Subject: | column_info returns the wrong default value for sequences under certain conditions |
Date: | Fri, 23 Nov 2007 12:44:25 +1300 |
To: | bug-DBD-Pg [...] rt.cpan.org |
From: | Nigel McNie <nigel [...] catalyst.net.nz> |
I have come across an problem in the way DBD::Pg retrieves column
information for use with the column_info method of DBI.
In postgres 8.1 and 8.2, the 'adsrc' column of the pg_attrdef table
contains the default value for the column when it was created, but the
'adbin' column is the only one updated if the column is changed. This
behaviour is most noticable when you change a sequence name, as per the
following:
http://paste.dollyfish.net.nz/5faf65
Note how postgres itself has strangely called the sequence_name the
original name in the final query. That is a separate issue, probably solved
in postgres 8.3 with the new ALTER SEQUENCE statement, although I have not
verified this.
Anyhow, the upshot is that DBD::Pg should probably look at the adbin column
to try and get the default for the column rather than the adsrc column.
Postgres version: PostgreSQL 8.1.8 on i486-pc-linux-gnu, compiled by GCC
cc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Perl version: This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
DBD::Pg version: 1.49-2 from debian.
System: Linux pg81 2.6.22.070809 #1 Thu Aug 9 14:15:40 NZST 2007 i686
GNU/Linux
--
Regards,
Nigel McNie
Catalyst IT Ltd.
DDI: +64 4 803 2203
Message body not shown because it is not plain text.