-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
> How does your DBI driver represent a default column value in
> the results returned by the column_info() method?
DBD::Pg quotes enough to allow it to work when passed
back in verbatim, with parens to indicate functions:
$dbh->do("DROP TABLE abc CASCADE");
$dbh->do("CREATE TABLE abc(
bar1 TEXT DEFAULT 'current_user',
bar2 TEXT DEFAULT current_user
)");
$sth = $dbh->column_info(undef, undef, 'abc', '');
$sth->execute();
for (@{$sth->fetchall_arrayref({})}) {
print "$_->{COLUMN_NAME} - $_->{COLUMN_DEF}\n";
}
Outputs:
bar1 - 'current_user'::text
bar2 - "current_user"()
> If NULL was specified as the default value, then this column is the word
> NULL, not enclosed in quotation marks.
However, we are definitely not doing this, and returning undef instead.
If the purpose of this field according to the ODBC spec is to allow
new column definitions, then I suppose DBD::Pg should change (although
undefined does map to NULL in other contexts, and NULL is the default
DEFAULT, so to speak, for most (all?) database systems).
- --
Greg Sabino Mullane [email protected] [email protected]
End Point Corporation
PGP Key: 0x14964AC8 200607261743
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iEYEAREDAAYFAkodV9kACgkQvJuQZxSWSsgAgACg08w+JwQ5CDn/wo1Xyr8KywEG
PIIAoL1kiaYWLDSmdS9+Eu1BfslupFxT
=3SqD
-----END PGP SIGNATURE-----