From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Libpq PGRES_COPY_BOTH - version compatibility |
Date: | 2010-12-28 12:13:41 |
Message-ID: | AANLkTinWDDW+u1jv6CEGz8BRdy9yOQ62uYtDgUSqsHHL@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-12-28 12:18:57 | Re: Libpq PGRES_COPY_BOTH - version compatibility |
Previous Message | Robert Haas | 2010-12-28 12:11:03 | Re: UPDATE pg_catalog.pg_proc.prosrc OK? |