Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-interfacespgsql-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: libpgtcl.patch
Description: text/plain (7.0 KB)

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group