Re: Make psql version aware; hide tablespace from older versions - Mailing list pgsql-patches

From Greg Sabino Mullane
Subject Re: Make psql version aware; hide tablespace from older versions
Date
Msg-id 7c00b53ea3213ebcce161f16b9f811d0@biglumber.com
Whole thread Raw
In response to Re: Make psql version aware; hide tablespace from older versions  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-patches
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> It's nice, but currently there are a lot of ways in which psql is
> broken regarding older server versions.  We should be caring about
> all of them (ideal), or about none (the current situation).
>
> There have been proposals in the past about making that happen.  You
> could investigate that (please do -- I'd love to have a cross-version
> psql, in the same way we have a cross-version compatible pg_dump).

The ultimate goal, of course, is to get to a more cross-version psql:
this is simply the first (but important) step in that direction. I was
a part of the previous discussions and remember them well. The basic
problem behind making psql able to handle previous versions was that
it would take some work and nobody felt like tackling it. Well, I finally
got irked enough when testing 7.5^H^H8.0 and psql'ing to my 7.4 database
(and getting reltablespace errors) that I decided to finally bite the
bullet. The 7.4 -> 7.5 jump is fairly easy, the 7.3 compatibility will
be a lot tougher. This will at least allow it to be used against the
previous version (7.4), which is a good start.

> The way of your patch is certain to lead into a mantainance nightmare :-(

Can you elaborate on that? There is no real simple way to do it, but
storing the version as a simple 9-digit int[1] and using ifs seems the easiest.
If there are too many ifs cluttering a section we can certainly consider
making separate functions, but right now nothing warrants that. My patch to
ignore tablespace in pre-7.5 has three additional checks inside of
describe.c, which I don't think is too bad.

 [1] If we can guarantee that we will never reach a "hundred" in any version
portion of PostgreSQL, the number could be smaller and easier to handle,
of course, but better safe than sorry.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200408072054

-----BEGIN PGP SIGNATURE-----

iD8DBQFBFXrbvJuQZxSWSsgRAhoFAKCAafstQcBMIuDR15tRk/a8Hih29gCgxl0g
yul9nXVtFxC+Db2DwL3YqUo=
=eVfA
-----END PGP SIGNATURE-----



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] UNICODE characters above 0x10000
Next
From: Tom Lane
Date:
Subject: Re: Make psql version aware; hide tablespace from older versions