libpgtcl - backend version information patch

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: pgsql-patches(at)postgresql(dot)org
Cc: pgsql-interfaces(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: libpgtcl - backend version information patch
Date: 2002-05-16 22:49:18
Message-ID: Pine.LNX.4.21.0205162311060.601-200000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces pgsql-patches

I've attached a patch for libpgtcl which adds access to backend version
numbers.

This is via a new command:

pg_version <db channel> <major varname> ?<minor varname>? ?<patch varname>?

Using readonly variables rather than a command was my first choice but I
decided that it was inappropiate for the library to start assigning global
variable(s) when that's really the applications job and the command interface
is consistent with the rest of the interface.

Obviously, backend version numbers are specific to a particular connection. So
I've created a new data structure, to keep the information as a distinct unit,
and added an instance of the new structure to the Pg_ConnectionId type. The
version information is retrieved from the given connection on first use of
pg_version and cached in the new data structure for subsequent accesses.

In addition to filling the named variables in the callers scope with version
numbers/strings the command returns the complete string as returned by
version(). It's not possible to turn this return off at the moment but I don't
see it as a problem since normal methods of stopping unwanted values returned
from procedures can be applied in the application if required.

Perhaps the most significant change is that I've increased the package's
version number from 1.3 to 1.4. This will adversly effect anyone using an
application that requires a specific version of the package where their
postgres installation is updated but their application has not been. I can't
imagine there are many applications out there using the package management
features of TCL though.

I envisage this patch applied to 7.3 tip and to 7.2 for the 7.2.2 release
mentioned a couple of days ago. The only problem with doing this for 7.2 that I
can see is where people doing the 'package -exact require Pgtcl 1.x' thing, and
how many of those are there? Even PgAccess doesn't use that.

Note for commiter et al,, this patch also includes one change made in 7.3devel
and not 7.2.1. That is where a test of the return value from a Tcl_SetVar call
has been corrected from a test against TCL_OK to NULL. This is correct and
should be applied to the 7.2 branch in my view, however, I do not know if this
has already been applied there so something to watch out for.

--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants

Attachment Content-Type Size
libpgtcl.patch text/plain 7.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-05-16 23:51:28 interfaces/ecpg/preproc reduce/reduce conflicts
Previous Message Joerg Hessdoerfer 2002-05-16 20:35:58 Re: WIN32 native ... lets start?!?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Nicolas Bazin 2002-05-17 00:11:39 date formats with ecpg and JDBC
Previous Message Doug McNaught 2002-05-16 12:49:02 Re: [INTERFACES] C & C ++Program Problem

Browse pgsql-patches by date

  From Date Subject
Next Message Bear Giles 2002-05-17 05:09:04 patch for SSL cleanup, client certificates
Previous Message John Gray 2002-05-16 17:46:26 Re: more verbose SSL session info for psql