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

Otheontelth otheontelth at protonmail.com
Wed Nov 15 15:24:10 EST 2017


Thanks for the fast help and generally for this great library

Sent with [ProtonMail](https://protonmail.com) Secure Email.

> -------- Original Message --------
> Subject: Re: [odb-users] Problem with schema_catalog::migrate and postgresql
> Local Time: 15 November 2017 4:53 PM
> UTC Time: 15 November 2017 15:53
> From: boris at codesynthesis.com
> To: Otheontelth <otheontelth at protonmail.com>
> odb-users at codesynthesis.com <odb-users at codesynthesis.com>
>
> 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:
>
> https://git.codesynthesis.com/cgit/odb/libodb-pgsql/commit/?id=5f24741c88cf4e86dc7c9f3d8dd967a4a7f04bcf
>
> You should be able to apply the patch to the current version.
>
> Thanks for the report!
>
> Boris


More information about the odb-users mailing list