Subject: | Problem with postgresql 7.3 |
I'm using PostgreSQL 7.3, and the tests fail. Attached is a patch to make them work again. It appears to be down to 2 things:
* sequence names are now prepended with the schema name.
* Dropping a table also drops the associated sequence.
Hope this helps,
-Dom
diff -urN Class-DBI-Pg-0.02/t/01_table.t Class-DBI-Pg-0.02-dom/t/01_table.t
--- Class-DBI-Pg-0.02/t/01_table.t Thu Aug 8 08:53:20 2002
+++ Class-DBI-Pg-0.02-dom/t/01_table.t Mon Feb 17 13:19:01 2003
@@ -21,6 +21,8 @@
)
SQL
+my $ver = (split ' ', $dbh->selectrow_array( 'SELECT version()' ))[1];
+
my $sth = $dbh->prepare(<<"SQL");
INSERT INTO class_dbi_pg1 (dat) VALUES(?)
SQL
@@ -42,7 +44,8 @@
my($obj2) = Class::DBI::Pg::Test->search(dat => 'foo');
is($obj2->id, 1);
-is(Class::DBI::Pg::Test->sequence, 'class_dbi_pg1_id_seq');
+# PostgreSQL 7.3 and later prepend this with the schema name.
+like(Class::DBI::Pg::Test->sequence, '/\bclass_dbi_pg1_id_seq\b/');
my $new_obj = Class::DBI::Pg::Test->create({ dat => 'newone'});
is($new_obj->id, 4);
@@ -58,7 +61,9 @@
END {
if ($dbh) {
- $dbh->do('DROP SEQUENCE class_dbi_pg1_id_seq');
+ # PG 7.3 and later automatically drop associated sequences.
+ $dbh->do('DROP SEQUENCE ' . Class::DBI::Pg::Test->sequence)
+ if $ver < 7.3;
$dbh->do('DROP TABLE class_dbi_pg1');
$dbh->disconnect;
}