Commit e617fe72 authored by Tom Lane's avatar Tom Lane

Mark server_encoding and integer_datetimes as GUC_REPORT, per previous

proposals by Oliver Jowett.  Update documentation.
parent c7ae53a6
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.158 2004/08/11 18:06:00 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.159 2004/08/16 02:12:29 tgl Exp $
--> -->
<chapter id="libpq"> <chapter id="libpq">
...@@ -848,28 +848,45 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName); ...@@ -848,28 +848,45 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName);
Certain parameter values are reported by the server automatically at Certain parameter values are reported by the server automatically at
connection startup or whenever their values change. connection startup or whenever their values change.
<function>PQparameterStatus</> can be used to interrogate these settings. <function>PQparameterStatus</> can be used to interrogate these settings.
It returns the current value of a parameter if known, or <symbol>NULL</symbol> if the parameter It returns the current value of a parameter if known, or <symbol>NULL</symbol>
is not known. if the parameter is not known.
</para> </para>
<para> <para>
Parameters reported as of the current release include Parameters reported as of the current release include
<literal>server_version</> (cannot change after startup); <literal>server_version</>,
<literal>server_encoding</>,
<literal>client_encoding</>, <literal>client_encoding</>,
<literal>is_superuser</>, <literal>is_superuser</>,
<literal>session_authorization</literal>, and <literal>session_authorization</>,
<literal>DateStyle</>. <literal>DateStyle</>, and
<literal>integer_datetimes</>.
(<literal>server_encoding</> and <literal>integer_datetimes</> were not
reported by releases before 8.0.)
Note that
<literal>server_version</>,
<literal>server_encoding</> and
<literal>integer_datetimes</>
cannot change after startup.
</para> </para>
<para> <para>
Pre-3.0-protocol servers do not report parameter settings, but Pre-3.0-protocol servers do not report parameter settings, but
<application>libpq</> includes logic to obtain values for <application>libpq</> includes logic to obtain values for
<literal>server_version</>, and <literal>client_encoding</>. <literal>server_version</> and <literal>client_encoding</> anyway.
Applications are encouraged to use <function>PQparameterStatus</> Applications are encouraged to use <function>PQparameterStatus</>
rather than ad-hoc code to determine these values. (Beware however rather than ad-hoc code to determine these values. (Beware however
that on a pre-3.0 connection, changing <literal>client_encoding</> via that on a pre-3.0 connection, changing <literal>client_encoding</> via
<command>SET</> after connection startup will not be reflected by <command>SET</> after connection startup will not be reflected by
<function>PQparameterStatus</>.) <function>PQparameterStatus</>.) For <literal>server_version</>,
see also <function>PQserverVersion</>, which returns the information
in a numeric form that is much easier to compare against.
</para>
<para>
Although the returned pointer is declared <literal>const</>, it in fact
points to mutable storage associated with the <literal>PGconn</> structure.
It is unwise to assume the pointer will remain valid across queries.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -904,10 +921,10 @@ int PQserverVersion(const PGconn *conn); ...@@ -904,10 +921,10 @@ int PQserverVersion(const PGconn *conn);
</synopsis> </synopsis>
Applications may use this to determine the version of the database server they 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 are connected to. The number is formed by converting the major, minor, and
revision numbers into two digit numbers and appending them together. For revision numbers into two-decimal-digit numbers and appending them
example, version 7.4.2 will be returned as 70402, and version 8.1 will be together. For example, version 7.4.2 will be returned as 70402, and version
returned as 80100 (leading zeroes are not shown). Zero is returned if the 8.1 will be returned as 80100 (leading zeroes are not shown). Zero is
connection is bad. returned if the connection is bad.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.52 2004/06/11 01:08:33 tgl Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.53 2004/08/16 02:12:29 tgl Exp $ -->
<chapter id="protocol"> <chapter id="protocol">
<title>Frontend/Backend Protocol</title> <title>Frontend/Backend Protocol</title>
...@@ -1046,12 +1046,20 @@ ...@@ -1046,12 +1046,20 @@
<para> <para>
At present there is a hard-wired set of parameters for which At present there is a hard-wired set of parameters for which
ParameterStatus will be generated: they are ParameterStatus will be generated: they are
<literal>server_version</> (a pseudo-parameter that cannot change after <literal>server_version</>,
startup); <literal>server_encoding</>,
<literal>client_encoding</>, <literal>client_encoding</>,
<literal>is_superuser</>, <literal>is_superuser</>,
<literal>session_authorization</literal>, and <literal>session_authorization</>,
<literal>DateStyle</>. <literal>DateStyle</>, and
<literal>integer_datetimes</>.
(<literal>server_encoding</> and <literal>integer_datetimes</> were not
reported by releases before 8.0.)
Note that
<literal>server_version</>,
<literal>server_encoding</> and
<literal>integer_datetimes</>
are pseudo-parameters that cannot change after startup.
This set might change in the future, or even become configurable. This set might change in the future, or even become configurable.
Accordingly, a frontend should simply ignore ParameterStatus for Accordingly, a frontend should simply ignore ParameterStatus for
parameters that it does not understand or care about. parameters that it does not understand or care about.
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.277 2004/08/13 16:29:55 momjian Exp $ $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.278 2004/08/16 02:12:29 tgl Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -2675,8 +2675,8 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32 ...@@ -2675,8 +2675,8 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32
<variablelist> <variablelist>
<varlistentry id="guc-datestyle" xreflabel="datestyle"> <varlistentry id="guc-datestyle" xreflabel="DateStyle">
<term><varname>datestyle</varname> (<type>string</type>)</term> <term><varname>DateStyle</varname> (<type>string</type>)</term>
<indexterm><primary>date style</></> <indexterm><primary>date style</></>
<listitem> <listitem>
<para> <para>
...@@ -3091,13 +3091,13 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -3091,13 +3091,13 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</sect3> </sect3>
</sect2> </sect2>
<sect2 id="runtime-config-compiler"> <sect2 id="runtime-config-preset">
<title>Compiled-in Options</title> <title>Preset Options</title>
<para> <para>
The following <quote>parameters</> are read-only, and are determined The following <quote>parameters</> are read-only, and are determined
when <productname>PostgreSQL</productname> is compiled. As such, when <productname>PostgreSQL</productname> is compiled or when it is
they have been excluded from the sample installed. As such, they have been excluded from the sample
<filename>postgresql.conf</> file. These options determine <filename>postgresql.conf</> file. These options determine
various aspects of <productname>PostgreSQL</productname> behavior various aspects of <productname>PostgreSQL</productname> behavior
that may be of interest to certain applications, particularly that may be of interest to certain applications, particularly
...@@ -3125,7 +3125,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -3125,7 +3125,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
<listitem> <listitem>
<para> <para>
Shows whether <productname>PostgreSQL</productname> was built Shows whether <productname>PostgreSQL</productname> 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 <literal>--enable-integer-datetimes</literal> configuring with <literal>--enable-integer-datetimes</literal>
when building <productname>PostgreSQL</productname>. The when building <productname>PostgreSQL</productname>. The
default value is <literal>off</literal>. default value is <literal>off</literal>.
...@@ -3133,6 +3133,30 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -3133,6 +3133,30 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="guc-lc-collate" xreflabel="lc_collate">
<term><varname>lc_collate</varname> (<type>string</type>)</term>
<listitem>
<para>
Shows the locale in which sorting of textual data is done.
See <xref linkend="locale"> for more information.
The value is determined when the database cluster is initialized.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-lc-ctype" xreflabel="lc_ctype">
<term><varname>lc_ctype</varname> (<type>string</type>)</term>
<listitem>
<para>
Shows the locale that determines character classifications.
See <xref linkend="locale"> for more information.
The value is determined when the database cluster is initialized.
Ordinarily this will be the same as <varname>lc_collate</varname>,
but for special applications it might be set differently.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-max-function-args" xreflabel="max_function_args"> <varlistentry id="guc-max-function-args" xreflabel="max_function_args">
<term><varname>max_function_args</varname> (<type>integer</type>)</term> <term><varname>max_function_args</varname> (<type>integer</type>)</term>
<listitem> <listitem>
...@@ -3168,6 +3192,29 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -3168,6 +3192,29 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry id="guc-server-encoding" xreflabel="server_encoding">
<term><varname>server_encoding</varname> (<type>string</type>)</term>
<indexterm><primary>character set</></>
<listitem>
<para>
Shows the database encoding (character set).
It is determined when the database is created. Ordinarily,
clients need only be concerned with the value of <xref
linkend="guc-client-encoding">.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-server-version" xreflabel="server_version">
<term><varname>server_version</varname> (<type>string</type>)</term>
<listitem>
<para>
Shows the version number of the server. It is determined by the
value of <literal>PG_VERSION</> when building the server.
</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</sect2> </sect2>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * 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[] = ...@@ -828,7 +828,7 @@ static struct config_bool ConfigureNamesBool[] =
{"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS, {"integer_datetimes", PGC_INTERNAL, COMPILE_OPTIONS,
gettext_noop("Datetimes are integer based"), gettext_noop("Datetimes are integer based"),
NULL, NULL,
GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
}, },
&integer_datetimes, &integer_datetimes,
#ifdef HAVE_INT64_TIMESTAMP #ifdef HAVE_INT64_TIMESTAMP
...@@ -1624,7 +1624,7 @@ static struct config_string ConfigureNamesString[] = ...@@ -1624,7 +1624,7 @@ static struct config_string ConfigureNamesString[] =
{"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE, {"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE,
gettext_noop("Sets the server (database) character set encoding."), gettext_noop("Sets the server (database) character set encoding."),
NULL, NULL,
GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
}, },
&server_encoding_string, &server_encoding_string,
"SQL_ASCII", NULL, NULL "SQL_ASCII", NULL, NULL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment