Subject: | Class::DBI does not correctly quote column names (Pg, maybe others) |
When attempting to use a table which contains a reserved name as a
column name, Class::DBI does not properly quote the column name when
issuing SQL requests. The attached script provides this output when
run against such a table:
Can't insert new main: DBD::Pg::st execute failed: ERROR: syntax
error at or near "user" at character 168 [for Statement "INSERT INTO
users (ulbandwidth, password, dlbandwidth, uid, user, gid, dir)
VALUES (?, ?, ?, ?, ?, ?, ?)
"]
at /usr/home/apeiron/software/perl/lib/site_perl/5.9.1/DBIx/ContextualFetch.pm
line 51.
Class::DBI::_croak('main=HASH(0x83f3e7c)', 'Can\'t insert new
main: DBD::Pg::st execute failed: ERROR: s...', 'err', 'DBD::Pg::st
execute failed: ERROR: syntax error at or near "...', 'method',
'create') called
at /usr/home/apeiron/software/perl/lib/site_perl/5.9.1/Class/DBI.pm
line 644
Class::DBI::_insert_row('main=HASH(0x83f3e7c)',
'HASH(0x83f3f78)') called
at /usr/home/apeiron/software/perl/lib/site_perl/5.9.1/Class/DBI.pm
line 590
Class::DBI::_create('main', 'HASH(0x83e8658)') called
at /usr/home/apeiron/software/perl/lib/site_perl/5.9.1/Class/DBI.pm
line 470
Class::DBI::create('main', 'HASH(0x83e8484)') called at class1
line 13
This works if I use straight DBI, Alzabo, or the psql command-line
utility. It also works for my FTP server which uses this database to
authenticate users. So, obviously, the problem lies somewhere in
between Class::DBI and DBI. I've tried every single quote permutation
of which I can think to try to solve this issue; cf.
http://www.perlmonks.org/index.pl?node_id=392477 for further
discussion.
Message body not shown because it is not plain text.