Subject: | Wierd results with multi-schema databases |
Perl 5.8.5
DB::Introspector 0.08
PostgreSQL 8.0.0rc5
DBD::Pg 1.32
Summary: DB::Introspector seems to ignore database SCHEMA, sometimes with odd results. This problem is two-fold:
1) There is no way to specify to any "table" method which schema to use (and I tried "SET search_path" on the database handle)
2) If you have 2 or more tables with the same name in different schema, find_table will munge all of the columns from all tables with the same name.
The latter deserves an example:
CREATE DATABASE test_schema;
CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.something (
thing1 INT,
thing2 INT
);
CREATE TABLE schema2.something (
thing1 INT,
thing2 INT
);
my $dbshamus = DB::Introspector->get_instance($pdbh);
my $tabletest = $dbshamus->find_table("something");
my @cols = map { $_->name } $tabletest->columns;
This will return:
"thing1,thing1,thing2,thing2"
I don't really expect you to fix this, I'm mainly filing it so that you'll bug *me* to fix it next OSCON.
--Josh Berkus
PostgreSQL Project