Re: Add version macro to libpq-fe.h

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Add version macro to libpq-fe.h
Дата
Msg-id 968815.1623936849@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Add version macro to libpq-fe.h  (Boris Kolpackov <boris@codesynthesis.com>)
Ответы Re: Add version macro to libpq-fe.h  (Robert Haas <robertmhaas@gmail.com>)
Re: Add version macro to libpq-fe.h  (Boris Kolpackov <boris@codesynthesis.com>)
Список pgsql-hackers
Boris Kolpackov <boris@codesynthesis.com> writes:
> I am making use of the new pipeline mode added to libpq in
> PostgreSQL 14. At the same time I would still like to support
> older libpq versions by not providing the extended functionality
> that depends on this mode.

Good point.

> The natural way to achieve this in C/C++ is to conditionally
> enable code that depends on the additional APIs based on the
> preprocessor macro. And I could easily do this if libpq-fe.h
> provided a macro containing its version.

I think putting a version number as such in there is a truly
horrid idea.  However, I could get behind adding a boolean flag
that says specifically whether the pipeline feature exists.
Then you'd do something like

#ifdef LIBPQ_HAS_PIPELINING

rather than embedding knowledge of exactly which release
added that.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: Fix for segfault in logical replication on master
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: locking [user] catalog tables vs 2pc vs logical rep