diff options
-rw-r--r-- | doc/src/sgml/libpq.sgml | 19 | ||||
-rw-r--r-- | doc/src/sgml/protocol.sgml | 3 | ||||
-rw-r--r-- | src/backend/utils/misc/guc.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-protocol2.c | 30 |
4 files changed, 22 insertions, 34 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index debfa26b727..fd06b51905c 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.133 2003/08/31 17:32:19 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.134 2003/09/01 23:04:49 petere Exp $ --> <chapter id="libpq"> @@ -856,21 +856,20 @@ is not known. <para> Parameters reported as of the current release include <literal>server_version</> (cannot change after startup); -<literal>server_encoding</> (also not presently changeable after start); <literal>client_encoding</>, <literal>is_superuser</>, and <literal>DateStyle</>. </para> <para> -Pre-3.0-protocol servers do not report parameter settings, -but <application>libpq</> includes logic to obtain values for -<literal>server_version</>, <literal>server_encoding</>, and -<literal>client_encoding</>. Applications are encouraged to use -<function>PQparameterStatus</> rather than ad-hoc code to determine these -values. (Beware however that on a pre-3.0 connection, changing -<literal>client_encoding</> via <command>SET</> after connection startup -will not be reflected by <function>PQparameterStatus</>.) +Pre-3.0-protocol servers do not report parameter settings, but +<application>libpq</> includes logic to obtain values for +<literal>server_version</>, and <literal>client_encoding</>. +Applications are encouraged to use <function>PQparameterStatus</> +rather than ad-hoc code to determine these values. (Beware however +that on a pre-3.0 connection, changing <literal>client_encoding</> via +<command>SET</> after connection startup will not be reflected by +<function>PQparameterStatus</>.) </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index 1de14ddeb61..5127bd66d52 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -1,4 +1,4 @@ -<!-- $Header: /cvsroot/pgsql/doc/src/sgml/protocol.sgml,v 1.41 2003/08/14 20:09:31 tgl Exp $ --> +<!-- $Header: /cvsroot/pgsql/doc/src/sgml/protocol.sgml,v 1.42 2003/09/01 23:04:49 petere Exp $ --> <chapter id="protocol"> <title>Frontend/Backend Protocol</title> @@ -1005,7 +1005,6 @@ ParameterStatus will be generated: they are <literal>server_version</> (a pseudo-parameter that cannot change after startup); - <literal>server_encoding</> (also not presently changeable after start); <literal>client_encoding</>, <literal>is_superuser</>, and <literal>DateStyle</>. diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 2f8226e5d30..fbf7cc5bff8 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.152 2003/09/01 04:15:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.153 2003/09/01 23:04:49 petere Exp $ * *-------------------------------------------------------------------- */ @@ -1479,7 +1479,7 @@ static struct config_string ConfigureNamesString[] = {"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE, gettext_noop("Server (database) character set encoding"), NULL, - GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE }, &server_encoding_string, "SQL_ASCII", NULL, NULL diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index 1b766996910..b776862ecc4 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.7 2003/08/27 00:33:34 petere Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.8 2003/09/01 23:04:49 petere Exp $ * *------------------------------------------------------------------------- */ @@ -177,10 +177,10 @@ pqSetenvPoll(PGconn *conn) * must use begin/commit in case autocommit is off by * default in a 7.3 server. * - * Note: version() and getdatabaseencoding() exist in all + * Note: version() exists in all * protocol-2.0-supporting backends. */ - if (!PQsendQuery(conn, "begin; select version(), getdatabaseencoding(); end")) + if (!PQsendQuery(conn, "begin; select version(); end")) goto error_return; conn->setenv_state = SETENV_STATE_QUERY1_WAIT; @@ -213,8 +213,8 @@ pqSetenvPoll(PGconn *conn) } /* - * Extract server version and database encoding, - * and save as if ParameterStatus + * Extract server version and save as if + * ParameterStatus */ val = PQgetvalue(res, 0, 0); if (val && strncmp(val, "PostgreSQL ", 11) == 0) @@ -236,12 +236,6 @@ pqSetenvPoll(PGconn *conn) val); } - val = PQgetvalue(res, 0, 1); - if (val && *val) /* null should not happen, - * but */ - pqSaveParameterStatus(conn, "server_encoding", - val); - PQclear(res); /* Keep reading until PQgetResult returns NULL */ } @@ -306,21 +300,17 @@ pqSetenvPoll(PGconn *conn) else { /* - * Error: presumably function not available, - * so use PGCLIENTENCODING or database - * encoding as the fallback. + * Error: presumably function not + * available, so use PGCLIENTENCODING or + * SQL_ASCII as the fallback. */ val = getenv("PGCLIENTENCODING"); if (val && *val) pqSaveParameterStatus(conn, "client_encoding", val); else - { - val = PQparameterStatus(conn, "server_encoding"); - if (val && *val) - pqSaveParameterStatus(conn, "client_encoding", - val); - } + pqSaveParameterStatus(conn, "client_encoding", + "SQL_ASCII"); } PQclear(res); |