From e617fe729d5ca625a58919c09d8117713ae6d51d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 16 Aug 2004 02:12:29 +0000 Subject: [PATCH] Mark server_encoding and integer_datetimes as GUC_REPORT, per previous proposals by Oliver Jowett. Update documentation. --- doc/src/sgml/libpq.sgml | 41 ++++++++++++++++------- doc/src/sgml/protocol.sgml | 18 ++++++++--- doc/src/sgml/runtime.sgml | 63 +++++++++++++++++++++++++++++++----- src/backend/utils/misc/guc.c | 6 ++-- 4 files changed, 100 insertions(+), 28 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 402f77bd7d..af9a35a620 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -848,28 +848,45 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName); 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. @@ -904,10 +921,10 @@ int PQserverVersion(const PGconn *conn); 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. diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index a88bca3002..f2f0fddabf 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -1,4 +1,4 @@ - + Frontend/Backend Protocol @@ -1046,12 +1046,20 @@ 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. diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index c1a3fa225b..9cca707519 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -2675,8 +2675,8 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32 - - datestyle (string) + + DateStyle (string) date style @@ -3091,13 +3091,13 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' - - Compiled-in Options + + 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 @@ -3125,7 +3125,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' 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. @@ -3133,6 +3133,30 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' + + 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) @@ -3168,6 +3192,29 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' + + server_encoding (string) + character set + + + Shows the database encoding (character set). + It is determined when the database is created. Ordinarily, + clients need only be concerned with the value of . + + + + + + server_version (string) + + + Shows the version number of the server. It is determined by the + value of PG_VERSION when building the server. + + + + diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index d015629c3e..d0a12840bc 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * 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 $ * *-------------------------------------------------------------------- */ @@ -828,7 +828,7 @@ static struct config_bool ConfigureNamesBool[] = {"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 @@ -1624,7 +1624,7 @@ static struct config_string ConfigureNamesString[] = {"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 -- 2.40.0