Certain parameter values are reported by the server automatically at
connection startup or whenever their values change.
PQparameterStatus> can be used to interrogate these settings.
-It returns the current value of a parameter if known, or NULL if the parameter
-is not known.
+It returns the current value of a parameter if known, or NULL
+if the parameter is not known.
Parameters reported as of the current release include
-server_version> (cannot change after startup);
+server_version>,
+server_encoding>,
client_encoding>,
is_superuser>,
-session_authorization, and
-DateStyle>.
+session_authorization>,
+DateStyle>, and
+integer_datetimes>.
+(server_encoding> and integer_datetimes> were not
+reported by releases before 8.0.)
+Note that
+server_version>,
+server_encoding> and
+integer_datetimes>
+cannot change after startup.
Pre-3.0-protocol servers do not report parameter settings, but
libpq> includes logic to obtain values for
-server_version>, and client_encoding>.
+server_version> and client_encoding> anyway.
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
SET> after connection startup will not be reflected by
-PQparameterStatus>.)
+PQparameterStatus>.) For server_version>,
+see also PQserverVersion>, which returns the information
+in a numeric form that is much easier to compare against.
+
+
+Although the returned pointer is declared const>, it in fact
+points to mutable storage associated with the PGconn> structure.
+It is unwise to assume the pointer will remain valid across queries.
Applications may use this to determine the version of the database server they
are connected to. The number is formed by converting the major, minor, and
-revision numbers into two digit numbers and appending them together. For
-example, version 7.4.2 will be returned as 70402, and version 8.1 will be
-returned as 80100 (leading zeroes are not shown). Zero is returned if the
-connection is bad.
+revision numbers into two-decimal-digit numbers and appending them
+together. For example, version 7.4.2 will be returned as 70402, and version
+8.1 will be returned as 80100 (leading zeroes are not shown). Zero is
+returned if the connection is bad.
-
+
Frontend/Backend Protocol
At present there is a hard-wired set of parameters for which
ParameterStatus will be generated: they are
- server_version> (a pseudo-parameter that cannot change after
- startup);
+ server_version>,
+ server_encoding>,
client_encoding>,
is_superuser>,
- session_authorization, and
- DateStyle>.
+ session_authorization>,
+ DateStyle>, and
+ integer_datetimes>.
+ (server_encoding> and integer_datetimes> were not
+ reported by releases before 8.0.)
+ Note that
+ server_version>,
+ server_encoding> and
+ integer_datetimes>
+ are pseudo-parameters that cannot change after startup.
This set might change in the future, or even become configurable.
Accordingly, a frontend should simply ignore ParameterStatus for
parameters that it does not understand or care about.
- datestyle">
- datestyle (string)
+ DateStyle">
+ DateStyle (string)
- compiler">
-
Compiled-in Options
+ preset">
+
Preset Options
The following parameters> are read-only, and are determined
- when
PostgreSQL is compiled
. As such,
- they have been excluded from the sample
+ when
PostgreSQL is compiled
or when it is
+ installed. As such, they have been excluded from the sample
postgresql.conf> file. These options determine
various aspects of
PostgreSQL behavior
that may be of interest to certain applications, particularly
Shows whether
PostgreSQL was built
- with support for 64-bit integer dates and times. It is set by
+ with support for 64-bit-integer dates and times. It is set by
configuring with --enable-integer-datetimes
when building
PostgreSQL. The
default value is off.
+
+ lc_collate (string)
+
+ Shows the locale in which sorting of textual data is done.
+ See for more information.
+ The value is determined when the database cluster is initialized.
+
+
+
+
+
+ lc_ctype (string)
+
+ Shows the locale that determines character classifications.
+ See for more information.
+ The value is determined when the database cluster is initialized.
+ Ordinarily this will be the same as lc_collate,
+ but for special applications it might be set differently.
+
+
+
+
max_function_args (integer)
+
+ server_encoding (string)
+
+ Shows the database encoding (character set).
+ It is determined when the database is created. Ordinarily,
+ clients need only be concerned with the value of
+ linkend="guc-client-encoding">.
+
+
+
+
+
+ server_version (string)
+
+ Shows the version number of the server. It is determined by the
+ value of PG_VERSION> when building the server.
+
+
+
+
* Written by Peter Eisentraut
.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.231 2004/08/11 21:10:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.232 2004/08/16 02:12:29 tgl Exp $
*
*--------------------------------------------------------------------
*/
{"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
gettext_noop("Datetimes are integer based"),
NULL,
- GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
},
&integer_datetimes,
#ifdef HAVE_INT64_TIMESTAMP
{"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE,
gettext_noop("Sets the server (database) character set encoding."),
NULL,
- GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
},
&server_encoding_string,
"SQL_ASCII", NULL, NULL