Parameters reported as of the current release include
server_version> (cannot change after startup);
-server_encoding> (also not presently changeable after start);
client_encoding>,
is_superuser>, and
DateStyle>.
-Pre-3.0-protocol servers do not report parameter settings,
-but
libpq> includes logic to obtain values for
-server_version>, server_encoding>, and
-client_encoding>. Applications are encouraged to use
-PQparameterStatus> rather than ad-hoc code to determine these
-values. (Beware however that on a pre-3.0 connection, changing
-<literal>client_encoding> via SET> after connection startup
-will not be reflected by PQparameterStatus>.)
+Pre-3.0-protocol servers do not report parameter settings, but
+
libpq> includes logic to obtain values for
+server_version>, and client_encoding>.
+Applications are encouraged to use PQparameterStatus>
+rather than ad-hoc code to determine these values. (Beware however
+that on a pre-3.0 connection, changing client_encoding> via
+<command>SET> after connection startup will not be reflected by
+PQparameterStatus>.)
* Written by Peter Eisentraut
.
*
* 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 $
*
*--------------------------------------------------------------------
*/
{"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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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;
}
/*
- * 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)
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 */
}
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);