Subject: | last_insert_id() fails if schema is not in search_path |
The last_insert_id function fails if the table's schema name is not in
search_path. I have patched my version of Pg.pm (ver 1.49) which used
to look like this:
308: $sth = $dbh->prepare("SELECT currval(?)");
309: $sth->execute($sequence);
to look like this:
308: $sth = $dbh->prepare("SELECT currval(?)");
309: $sequence = "$schema.$sequence" if $schema;
310: $sth->execute($sequence);
Everything is fine now. I think this bug should be fixed because not
only is last_insert_id() broken tables whose schema is not in
search_path, but it is possible that last_insert_id() could return the
value for the wrong table if two schemas have tables with the same
name.
John Supplee