summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-protocol2.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-03-05 01:53:59 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-03-05 01:53:59 +0000
commit44611f6e6d2cd11ac2c6dc1f41c13a98ec633f08 (patch)
treea6386e8e5b42fba514d25f786c6b1a5e4e93764a /src/interfaces/libpq/fe-protocol2.c
parentd91acf840136f751898378c0ff41d317e993d1a6 (diff)
downloadpostgresql-44611f6e6d2cd11ac2c6dc1f41c13a98ec633f08.tar.gz
libpq's query to get the OIDs of large-object support functions was not
schema-safe. Make it so, and improve the internal support for knowledge of server version.
Diffstat (limited to 'src/interfaces/libpq/fe-protocol2.c')
-rw-r--r--src/interfaces/libpq/fe-protocol2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c
index 8c214fa8e9..369481b338 100644
--- a/src/interfaces/libpq/fe-protocol2.c
+++ b/src/interfaces/libpq/fe-protocol2.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.9 2003/11/29 19:52:12 pgsql Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.10 2004/03/05 01:53:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -178,7 +178,9 @@ pqSetenvPoll(PGconn *conn)
* default in a 7.3 server.
*
* Note: version() exists in all
- * protocol-2.0-supporting backends.
+ * protocol-2.0-supporting backends. In 7.3 it would
+ * be safer to write pg_catalog.version(), but we can't
+ * do that without causing problems on older versions.
*/
if (!PQsendQuery(conn, "begin; select version(); end"))
goto error_return;
@@ -258,8 +260,9 @@ pqSetenvPoll(PGconn *conn)
* in 7.3 servers where we need to prevent
* autocommit-off from starting a transaction anyway.
*/
- if (strncmp(conn->sversion, "7.3", 3) == 0)
- query = "begin; select pg_client_encoding(); end";
+ if (conn->sversion >= 70300 &&
+ conn->sversion < 70400)
+ query = "begin; select pg_catalog.pg_client_encoding(); end";
else
query = "select pg_client_encoding()";
if (!PQsendQuery(conn, query))