Re: [HACKERS] PQfnumber and quoted identifiers - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [HACKERS] PQfnumber and quoted identifiers
Date
Msg-id 6598.1065376938@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] PQfnumber and quoted identifiers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-interfaces
Andreas Pflug <pgadmin@pse-consulting.de> writes:
> If you change it, please give me a chance to code it version-aware so 
> quoting/non-quoting can be performed dependent on libpq in use.

If you want a run-time test, the most reliable way would be to directly
test what PQfnumber does --- for instance, make a query known to
contain the column name "foo", and see what PQfnumber(res, "\"foo\"")
returns.  I'm not sure there is any other solution, since we can't
retroactively install a version identifier in old libpq releases.

For a compile-time test, you could perhaps look to see if
PG_DIAG_SQLSTATE or one of the other new macros in postgres_ext.h
is defined.  Not sure you really want a compile-time test though;
it'd break very easily if you get linked against some other version
of the library.

As for the more general question of whether to offer libpq version
identification going forward, I have no strong opinion on whether
it's really useful or not.  If it's wanted, I'm tempted to suggest
that PQparameterStatus() could be extended to recognize "libpq_version"
paralleling "server_version".  Not sure about a clean way to expose
the version at compile time.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] PQfnumber and quoted identifiers
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] PQfnumber and quoted identifiers