[odb-users] Problem with schema_catalog::migrate and postgresql

Boris Kolpackov boris at codesynthesis.com
Wed Nov 15 10:53:13 EST 2017

Ok, I've investigated this further and it appears to be due to PG's habit
of poisoning transactions. The comment from the path explains:

// If we are in the user's transaction then things are complicated. When
// we try to execute SELECT on a non-existent table, PG "poisons" the
// transaction (those "current transaction is aborted, commands ignored
// until end of transaction block" messages in the log). Which means all
// the user's schema creation statements that are likely to follow will
// fail.
// There doesn't seem to be a better way to solve this than to check for
// the table's existence. It is relatively easy to do with to_regclass()
// in 9.4+ and a real pain in earlier versions. So we are going to do
// this for 9.4+ and for older versions the workaround is to "pre-call"
// database::schema_version() outside of any transaction.

I've committed the workaround for the next release:


You should be able to apply the patch to the current version.

Thanks for the report!


More information about the odb-users mailing list