Subject: | Identifiers are not quoted in SELECT used to retrieve column names. |
In the DBIx::Class::Schema::Loader::DBI::_table_columns method, a dummy
SELECT statement is used to obtain column names. The table name is used
unquoted regardless of the quote_char setting associated with the
schema's storage. This causes the SELECT to fail for PostgreSQL tables
with non-lowercase characters in the table name, as unquoted identifiers
are silently treated as lowercase by PostgreSQL.
The attached patch against 0.3009 rectifies the problem.
Subject: | quote-identifiers-in-column-name-select.patch |
--- /usr/share/perl5/DBIx/Class/Schema/Loader/DBI.pm 2006-12-01 15:41:23.000000000 +0000
+++ lib/DBIx/Class/Schema/Loader/DBI.pm 2007-01-15 03:42:15.000000000 +0000
@@ -87,8 +87,11 @@
my $dbh = $self->schema->storage->dbh;
+ $table = $self->{_quoter} . $table . $self->{_quoter};
+
if($self->{db_schema}) {
- $table = $self->{db_schema} . $self->{_namesep} . $table;
+ $table = $self->{_quoter} . $self->{db_schema} . $self->{_quoter}
+ . $self->{_namesep} . $table;
}
my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0");