@Robie: It's been a while since I dabbled with this, but to me this is
not really "wishlist", it's an actual bug. Surely pg_wrapper doesn't
document that it looks at the explicitly specified port, but it
certainly ought to. This case was just plain forgotten.

So the patch certainly needs some massaging, at least:

 - adjust it to current version [1], which e. g. has $explicit_port instead of 
$port_specified
 - Fix the "locahost" typo, and support IP addresses as well (127.0.0.* or ::1)
 - Add an integration test to 
https://salsa.debian.org/postgresql/postgresql-common/blob/master/t/090_multicluster.t

but the general heading of it seems fine to me.

[1] https://salsa.debian.org/postgresql/postgresql-
common/blob/master/pg_wrapper

** Changed in: postgresql-common (Ubuntu)
   Importance: Wishlist => Medium

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to postgresql-common in Ubuntu.
https://bugs.launchpad.net/bugs/1796407

Title:
  pg_wrapper doesn't work when -p is used

Status in postgresql-common package in Ubuntu:
  Triaged

Bug description:
  Release:        16.04

  pg_wrapper currently relies upon either run-time-supplied data or fixed files 
which can become out of date to select the correct version of clients. 
  Alternatively it chooses (potentially incompatible) versions of installed 
programs  based on which cluster is using port 5432, even when a different port 
is in use, despite code intended to default to the newest version.

  The problem is that the call to user_cluster_map() returns the default port, 
and thus the
  condition just below this comment is not executed:

  # if we only have a port, but no version here, use the latest version
  # TODO: this could be improved by better argument parsing and mapping back the
  # port to a cluster version/name
  if (!$version and $port_specified) {
      $version = get_newest_version;
  }

  E.g. (here shown for an old system which has 9.1 on port 5432, and 9.3 on 
port 5433, similar results have been obtained on more up to date systems):
  pg_dump -p 5433
  pg_dump: server version: 9.3.24; pg_dump version: 9.1.24
  pg_dump: aborting because of server version mismatch

  Observed behaviour, ignore port value and newest version and instead choose 
version from port 5432.
  Expected behaviour: (as per code below comment) choose version 9.3

  The supplied patch implements the TODO: above. 
  If a port (and no host other than localhost) has been specified, it 
interrogates the configuration files to identify which cluster and version is 
listening on the specified port (via -p, --port or PGPORT environment variable) 
and selects those in the case that a port has been specified.

  NB. the patch will probably not apply cleanly to the current version
  in debian/sid, as some reworking of that has happened. Looking at that
  code, however, the problem addressed here has not gone away:
  user_cluster_map() still returns a port while the code in pg_wrapper
  expects it not to.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postgresql-common/+bug/1796407/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to