/usr/bin/psql misinterprets cluster version in ~/.postgresqlrc

Bug #1330055 reported by Sergio Gelato
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
postgresql-common (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

I've just upgraded a client from precise to trusty. As part of that upgrade, postgresql-client-9.1 was uninstalled and replaced with postgresql-client-9.3. This broke the psql client's access to databases that are listed in ~/.postgresqlrc as running version 9.1. If I run

psql dbname

I now get the following error:

Error: /home/username/.postgresqlrc line 2: version 9.1 does not exist

The relevant line of /home/username/.postgresqlrc looks like this:

9.1 dbhost:5432 dbname

This is correct according to the documentation: the postgresqlrc(5) man page describes the VERSION column as "The major PostgreSQL version *of the cluster to connect to*" (emphasis mine). Note also the comment in /usr/share/postgresql-common/pg_wrapper that says:

# for psql we always want the latest version, as this is backwards compatible
# to every major version that that we support

Unfortunately the flow of control never reaches that point in the code; user_cluster_map() (in PgCommon.pm) calls version_exists(9.1) and throws an error because *on the client* there is only version 9.3. The check is erroneous since it assumes that the client and the server have the same versions of PostgreSQL installed.

I could lie to the wrapper and claim that the database cluster runs version 9.3, were it not for the fact that /home/username is on a network share and the same file needs to work for both precise and trusty (and wheezy) clients.

This report is about Ubuntu 14.04 LTS, with version 154 of postgresql-client-common. I haven't researched whether any other releases are affected.

Martin Pitt (pitti)
Changed in postgresql-common (Ubuntu):
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.