Libpq PGRES_COPY_BOTH - version compatibility

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Libpq PGRES_COPY_BOTH - version compatibility
Дата
Msg-id AANLkTinWDDW+u1jv6CEGz8BRdy9yOQ62uYtDgUSqsHHL@mail.gmail.com
обсуждение исходный текст
Ответы Re: Libpq PGRES_COPY_BOTH - version compatibility  (Robert Haas <robertmhaas@gmail.com>)
Re: Libpq PGRES_COPY_BOTH - version compatibility  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Part of this may be my C skills not being good enough - if so, please
enlighten me :-)


My pg_streamrecv no longer works with 9.1, because it returns
PGRES_COPY_BOTH instead of PGRES_COPY_OUT when initating a copy.
That's fine.

So I'd like to make it work on both. Specifically, I would like it to
check for PGRES_COPY_BOTH if the server is 9.1 and PGRES_COPY_OUT if
it's 9.0. Which can be done by checking the server version.

However, when built against a libpq 9.0, it doesn't even have the
symbol PGRES_COPY_BOTH. And I can't check for the presence of said
symbol using #ifdef, since it's an enum. Nor is there a #define
available to check the version of the header.

Is there any way to check this at compile time (so I know if I can use
the symbol or not), without using autoconf (I don't want to bring in
such a huge dependency for a tiny program)?

Also, I notice that PGRES_COPY_BOTH was inserted "in the middle" of
the enum. Doesn't that mean we can get incorrect values for e.g.
PGRES_FATAL_ERROR if the client is built against one version of libpq
but executes against another? Shouldn't all such enum values always be
added at the end?

Finaly, as long as I only use "the 9.0 style replication",
PGRES_COPY_BOTH is actually unnecessary, right? It will work exactly
the same way as PGRES_COPY_OUT?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: UPDATE pg_catalog.pg_proc.prosrc OK?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Libpq PGRES_COPY_BOTH - version compatibility