2014-09-05 07:44:07 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:37:21 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.pg-parameter-status" xmlns="http://docbook.org/ns/docbook">
|
2004-05-02 15:47:00 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>pg_parameter_status</refname>
|
2018-01-25 15:34:22 +00:00
|
|
|
<refpurpose>Looks up a current parameter setting of the server</refpurpose>
|
2004-05-02 15:47:00 +00:00
|
|
|
</refnamediv>
|
2005-03-11 16:03:26 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2004-05-02 15:47:00 +00:00
|
|
|
<methodsynopsis>
|
2004-08-13 16:12:06 +00:00
|
|
|
<type>string</type><methodname>pg_parameter_status</methodname>
|
2009-01-19 15:13:01 +00:00
|
|
|
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
|
2004-09-25 09:27:26 +00:00
|
|
|
<methodparam><type>string</type><parameter>param_name</parameter></methodparam>
|
2004-05-02 15:47:00 +00:00
|
|
|
</methodsynopsis>
|
2004-09-25 09:27:26 +00:00
|
|
|
<para>
|
2005-04-03 07:21:50 +00:00
|
|
|
Looks up a current parameter setting of the server.
|
2004-09-25 09:27:26 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2005-04-03 07:27:30 +00:00
|
|
|
Certain parameter values are reported by the server automatically at
|
|
|
|
connection startup or whenever their values change. <function>pg_parameter_status</function> can be
|
|
|
|
used to interrogate these settings. It returns the current value of a
|
|
|
|
parameter if known, or &false; if the parameter is not known.
|
2005-04-03 07:21:50 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2005-04-03 07:27:30 +00:00
|
|
|
Parameters reported as of PostgreSQL 8.0 include <literal>server_version</literal>,
|
2005-04-03 07:21:50 +00:00
|
|
|
<literal>server_encoding</literal>, <literal>client_encoding</literal>,
|
2005-04-03 07:27:30 +00:00
|
|
|
<literal>is_superuser</literal>, <literal>session_authorization</literal>,
|
2005-04-03 07:21:50 +00:00
|
|
|
<literal>DateStyle</literal>, <literal>TimeZone</literal>, and <literal>integer_datetimes</literal>.
|
2005-04-03 07:27:30 +00:00
|
|
|
(<literal>server_encoding</literal>, <literal>TimeZone</literal>, and
|
|
|
|
<literal>integer_datetimes</literal> were not reported by releases before 8.0.) Note that
|
2005-04-03 07:21:50 +00:00
|
|
|
<literal>server_version</literal>, <literal>server_encoding</literal> and <literal>integer_datetimes</literal>
|
2005-04-03 07:27:30 +00:00
|
|
|
cannot change after PostgreSQL startup.
|
2005-04-03 07:21:50 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
PostgreSQL 7.3 or lower servers do not report parameter settings,
|
2005-04-03 07:27:30 +00:00
|
|
|
<function>pg_parameter_status</function>
|
2005-04-03 07:21:50 +00:00
|
|
|
includes logic to obtain values for <literal>server_version</literal> and
|
2005-04-03 07:27:30 +00:00
|
|
|
<literal>client_encoding</literal>
|
|
|
|
anyway. Applications are encouraged to use <function>pg_parameter_status</function> rather than ad
|
2005-04-03 07:21:50 +00:00
|
|
|
hoc code to determine these values.
|
|
|
|
</para>
|
|
|
|
<caution>
|
|
|
|
<para>
|
2005-04-03 07:27:30 +00:00
|
|
|
On a pre-7.4
|
|
|
|
PostgreSQL server, changing <literal>client_encoding</literal> via <literal>SET</literal> after connection startup will
|
2005-04-03 07:21:50 +00:00
|
|
|
not be reflected by <function>pg_parameter_status</function>.
|
2005-04-03 07:27:30 +00:00
|
|
|
</para>
|
2005-04-03 07:21:50 +00:00
|
|
|
</caution>
|
|
|
|
</refsect1>
|
|
|
|
|
2005-04-03 07:27:30 +00:00
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>connection</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
PostgreSQL database connection resource. When
|
|
|
|
<parameter>connection</parameter> is not present, the default connection
|
|
|
|
is used. The default connection is the last connection made by
|
|
|
|
<function>pg_connect</function> or <function>pg_pconnect</function>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>param_name</parameter></term>
|
2005-04-03 07:21:50 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-04-03 07:27:30 +00:00
|
|
|
Possible <parameter>param_name</parameter> values include <literal>server_version</literal>,
|
2005-04-03 07:21:50 +00:00
|
|
|
<literal>server_encoding</literal>, <literal>client_encoding</literal>,
|
2005-04-03 07:27:30 +00:00
|
|
|
<literal>is_superuser</literal>, <literal>session_authorization</literal>,
|
2005-04-03 07:21:50 +00:00
|
|
|
<literal>DateStyle</literal>, <literal>TimeZone</literal>, and
|
|
|
|
<literal>integer_datetimes</literal>.
|
|
|
|
</para>
|
2005-04-03 07:27:30 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>A <type>string</type> containing the value of the parameter, &false; on failure or invalid
|
|
|
|
<parameter>param_name</parameter>.</para>
|
2005-04-03 07:21:50 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>pg_parameter_status</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
|
|
|
|
|
|
|
|
echo "Server encoding: ", pg_parameter_status($dbconn, "server_encoding");
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
2005-04-03 07:27:30 +00:00
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
2005-04-03 07:21:50 +00:00
|
|
|
<![CDATA[
|
2005-04-03 07:27:30 +00:00
|
|
|
Server encoding: SQL_ASCII
|
|
|
|
]]>
|
2005-04-03 07:21:50 +00:00
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
2004-05-02 15:47:00 +00:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2004-05-02 15:47:00 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|