I've just rebooted my macos laptop for the first time in months
and have started having a problem loading database backups there.
I get this error output:
pg_restore: [archiver (db)] Error while INITIALIZING:
pg_restore: [archiver (db)] could not execute query: ERROR: unrecognized configuration parameter "idle_in_transaction_session_timeout"
Command was: SET idle_in_transaction_session_timeout = 0;
It seems that I was using 9.6 clients and a 9.5 server.
I'm not sure what the situation was before the reboot.
The server was probably 9.6.12 and all was well.
I never got around to fully upgrading the server
(or the old version wouldn't still be there).
Loading a 9.5 backup using the 9.6 pg_restore lead to
the above error. Changing to 9.5 clients fixed it.
Since the backup itself was from a 9.5.12 server, it
seems that the 9.6 parameter, idle_in_transaction_session_timeout,
must have been set by the 9.6 client even though it was
connected to a 9.5 server. Is that expected behaviour?
Do the clients know when each configuration parameter
was introduced and only use them when connected to servers
where they mean something? Or am I just misunderstaing
what's happening? I would have thought a new client
would be able to work with an old but supported server.
It's not a big deal. I'll get around to completing the
upgrade and it'll be fine again but I'm curious.
Re: question about client/server version mismatches
On Tue, Aug 13, 2019 at 12:45:35PM +1000, raf wrote:
> Since the backup itself was from a 9.5.12 server, it
> seems that the 9.6 parameter, idle_in_transaction_session_timeout,
> must have been set by the 9.6 client even though it was
> connected to a 9.5 server. Is that expected behaviour?
Yes, the compatibility of pg_dump is mentioned in the docs, and things
happen so as pg_dump can be used to transfer data to newer versions:
https://www.postgresql.org/docs/devel/app-pgdump.html Please see from "Because pg_dump is used to transfer data to newer
versions of PostgreSQL...".
So doing a dump from a 9.5 instance using pg_dump from 9.6 would have
set the parameter.