Re: [HACKERS] PQfnumber and quoted identifiers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [HACKERS] PQfnumber and quoted identifiers
Date: 2003-10-05 18:02:18
Message-ID: 6598.1065376938@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Andreas Pflug <pgadmin(at)pse-consulting(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-05 18:03:52 Re: [HACKERS] PQfnumber and quoted identifiers
Previous Message Bruce Momjian 2003-10-05 17:58:21 Re: PQfnumber and quoted identifiers

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2003-10-05 18:03:52 Re: [HACKERS] PQfnumber and quoted identifiers
Previous Message Bruce Momjian 2003-10-05 17:58:21 Re: PQfnumber and quoted identifiers