1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Create a GUC variable REGEX_FLAVOR to control the type of regular

expression accepted by the regex operators, per discussion yesterday.

Along the way, reduce deadlock_timeout from PGC_POSTMASTER to PGC_SIGHUP
category.  It is probably best to insist that all backends share the same
setting, but that doesn't mean it has to be frozen at startup.
This commit is contained in:
Tom Lane
2003-02-06 20:25:33 +00:00
parent 465ed56531
commit 77ede8900d
7 changed files with 114 additions and 53 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.137 2003/02/05 17:41:32 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.138 2003/02/06 20:25:31 tgl Exp $
PostgreSQL documentation
-->
@ -2665,10 +2665,24 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
due to their availability in programming languages such as Perl and Tcl.
<acronym>RE</acronym>s using these non-POSIX extensions are called
<firstterm>advanced</> <acronym>RE</acronym>s or <acronym>ARE</>s
in this documentation. We first describe the ERE/ARE flavor and then
mention the restrictions of the BRE form.
in this documentation. AREs are almost an exact superset of EREs,
but BREs have several notational incompatibilities (as well as being
much more limited).
We first describe the ARE and ERE forms, noting features that apply
only to AREs, and then describe how BREs differ.
</para>
<note>
<para>
The form of regular expressions accepted by <productname>PostgreSQL</>
can be chosen by setting the <varname>REGEX_FLAVOR</> run-time parameter
(described in the &cite-admin;). The usual setting is
<literal>advanced</>, but one might choose <literal>extended</> for
maximum backwards compatibility with pre-7.4 releases of
<productname>PostgreSQL</>.
</para>
</note>
<para>
A regular expression is defined as one or more
<firstterm>branches</firstterm>, separated by
@ -2784,7 +2798,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
meaning in <productname>PostgreSQL</> string literals.
To write a pattern constant that contains a backslash,
you must write two backslashes in the query.
</para>
</para>
</note>
<table id="posix-quantifiers-table">
@ -3392,11 +3406,11 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
</para>
<para>
Normally the flavor of RE being used is specified by
application-dependent means.
However, this can be overridden by a <firstterm>director</>.
Normally the flavor of RE being used is determined by
<varname>REGEX_FLAVOR</>.
However, this can be overridden by a <firstterm>director</> prefix.
If an RE of any flavor begins with <literal>***:</>,
the rest of the RE is an ARE.
the rest of the RE is taken as an ARE.
If an RE of any flavor begins with <literal>***=</>,
the rest of the RE is taken to be a literal string,
with all characters considered ordinary characters.
@ -3407,8 +3421,8 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
a sequence <literal>(?</><replaceable>xyz</><literal>)</>
(where <replaceable>xyz</> is one or more alphabetic characters)
specifies options affecting the rest of the RE.
These supplement, and can override,
any options specified externally.
These options override any previously determined options (including
both the RE flavor and case sensitivity).
The available option letters are
shown in <xref linkend="posix-embedded-options-table">.
</para>
@ -3432,7 +3446,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
<row>
<entry> <literal>c</> </entry>
<entry> case-sensitive matching (usual default) </entry>
<entry> case-sensitive matching (overrides operator type) </entry>
</row>
<row>
@ -3443,7 +3457,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
<row>
<entry> <literal>i</> </entry>
<entry> case-insensitive matching (see
<xref linkend="posix-matching-rules">) </entry>
<xref linkend="posix-matching-rules">) (overrides operator type) </entry>
</row>
<row>
@ -3471,12 +3485,12 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
<row>
<entry> <literal>s</> </entry>
<entry> non-newline-sensitive matching (usual default) </entry>
<entry> non-newline-sensitive matching (default) </entry>
</row>
<row>
<entry> <literal>t</> </entry>
<entry> tight syntax (usual default; see below) </entry>
<entry> tight syntax (default; see below) </entry>
</row>
<row>
@ -3696,7 +3710,7 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
</para>
<para>
Two significant incompatibilites exist between AREs and the ERE syntax
Two significant incompatibilities exist between AREs and the ERE syntax
recognized by pre-7.4 releases of <productname>PostgreSQL</>:
<itemizedlist>
@ -3717,6 +3731,10 @@ SUBSTRING('foobar' FROM 'o(.)b') <lineannotation>o</lineannotation>
</para>
</listitem>
</itemizedlist>
While these differences are unlikely to create a problem for most
applications, you can avoid them if necessary by
setting <varname>REGEX_FLAVOR</> to <literal>extended</>.
</para>
</sect3>

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.167 2003/01/25 23:10:27 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.168 2003/02/06 20:25:31 tgl Exp $
-->
<Chapter Id="runtime">
@ -1447,8 +1447,7 @@ env PGOPTIONS='-c geqo=off' psql
practice. On a heavily loaded server you might want to raise it.
Ideally the setting should exceed your typical transaction time,
so as to improve the odds that the lock will be released before
the waiter decides to check for deadlock. This option can only
be set at server start.
the waiter decides to check for deadlock.
</para>
</listitem>
</varlistentry>
@ -1781,6 +1780,20 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
</listitem>
</varlistentry>
<varlistentry>
<term><varname>REGEX_FLAVOR</varname> (<type>string</type>)</term>
<indexterm><primary>regular expressions</></>
<listitem>
<para>
The regular expression <quote>flavor</> can be set to
<literal>advanced</>, <literal>extended</>, or <literal>basic</>.
The usual default is <literal>advanced</>. The <literal>extended</>
setting may be useful for exact backwards compatibility with
pre-7.4 releases of <productname>PostgreSQL</>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>SEARCH_PATH</varname> (<type>string</type>)</term>
<indexterm><primary>search_path</></>