Re: [HACKERS] PQfnumber and quoted identifiers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] PQfnumber and quoted identifiers
Дата
Msg-id 6598.1065376938@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] PQfnumber and quoted identifiers  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] PQfnumber and quoted identifiers
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] PQfnumber and quoted identifiers