mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~". Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape). Extend the definition to make the FOR clause optional. Define textregexsubstr() to actually implement this feature. Update the regression test to include these new string features. All tests pass. Rename the regular expression support routines from "pg95_xxx" to "pg_xxx". Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.27 2002/02/12 22:25:15 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.28 2002/06/11 15:32:32 thomas Exp $
|
||||
-->
|
||||
|
||||
<chapter id="tutorial-advanced">
|
||||
@ -114,7 +114,6 @@ CREATE TABLE weather (
|
||||
prcp real,
|
||||
date date
|
||||
);
|
||||
|
||||
</programlisting>
|
||||
|
||||
Now try inserting an invalid record:
|
||||
@ -126,7 +125,6 @@ INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
|
||||
<screen>
|
||||
ERROR: <unnamed> referential integrity violation - key referenced from weather not found in cities
|
||||
</screen>
|
||||
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -162,6 +160,7 @@ ERROR: <unnamed> referential integrity violation - key referenced from we
|
||||
Suppose that we want to record a payment of $100.00 from Alice's account
|
||||
to Bob's account. Simplifying outrageously, the SQL commands for this
|
||||
might look like
|
||||
|
||||
<programlisting>
|
||||
UPDATE accounts SET balance = balance - 100.00
|
||||
WHERE name = 'Alice';
|
||||
@ -172,6 +171,9 @@ UPDATE accounts SET balance = balance + 100.00
|
||||
UPDATE branches SET balance = balance + 100.00
|
||||
WHERE name = (SELECT branch_name FROM accounts WHERE name = 'Bob');
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The details of these commands are not important here; the important
|
||||
point is that there are several separate updates involved to accomplish
|
||||
this rather simple operation. Our bank's officers will want to be
|
||||
@ -219,6 +221,7 @@ UPDATE branches SET balance = balance + 100.00
|
||||
the SQL commands of the transaction with
|
||||
<command>BEGIN</> and <command>COMMIT</> commands. So our banking
|
||||
transaction would actually look like
|
||||
|
||||
<programlisting>
|
||||
BEGIN;
|
||||
UPDATE accounts SET balance = balance - 100.00
|
||||
@ -226,6 +229,9 @@ UPDATE accounts SET balance = balance - 100.00
|
||||
-- etc etc
|
||||
COMMIT;
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If, partway through the transaction, we decide we don't want to
|
||||
commit (perhaps we just noticed that Alice's balance went negative),
|
||||
we can issue the command <command>ROLLBACK</> instead of
|
||||
@ -310,7 +316,9 @@ CREATE TABLE capitals (
|
||||
state char(2)
|
||||
) INHERITS (cities);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In this case, a row of <classname>capitals</classname>
|
||||
<firstterm>inherits</firstterm> all columns (<structfield>name</>,
|
||||
<structfield>population</>, and <structfield>altitude</>) from its
|
||||
@ -397,7 +405,6 @@ SELECT name, altitude
|
||||
site</ulink> for links to more resources.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.92 2002/05/03 04:11:07 tgl Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.93 2002/06/11 15:32:32 thomas Exp $
|
||||
-->
|
||||
|
||||
<chapter id="datatype">
|
||||
@ -2637,7 +2637,8 @@ SELECT * FROM test1 WHERE a;
|
||||
The <type>inet</type> type holds an IP host address, and
|
||||
optionally the identity of the subnet it is in, all in one field.
|
||||
The subnet identity is represented by the number of bits in the
|
||||
network part of the address (the <quote>netmask</quote>). If the netmask is 32,
|
||||
network part of the address (the <quote>netmask</quote>). If the
|
||||
netmask is 32,
|
||||
then the value does not indicate a subnet, only a single host.
|
||||
Note that if you want to accept networks only, you should use the
|
||||
<type>cidr</type> type rather than <type>inet</type>.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.138 2002/05/22 17:20:58 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.139 2002/06/11 15:32:33 thomas Exp $
|
||||
-->
|
||||
|
||||
<appendix id="release">
|
||||
@ -44,6 +44,9 @@ Access privileges on procedural languages
|
||||
CREATE DATABASE has OWNER option so superuser can create DB for someone else
|
||||
Kerberos 5 support now works with Heimdal
|
||||
Database and user-specific session defaults for run-time configuration variables (ALTER DATABASE ... SET and ALTER USER ... SET)
|
||||
String function OVERLAY() implemented per SQL99
|
||||
Regular expression operator SIMILAR TO implemented per SQL99
|
||||
Regular expression function SUBSTRING() implemented per SQL99
|
||||
]]></literallayout>
|
||||
|
||||
</sect1>
|
||||
|
Reference in New Issue
Block a user