Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde9be56

Browse files
committed
Use FROM clause in example UPDATE commands where appropriate. Also
remove long-obsolete statement that there isn't a check for infiniterecursion in view rules.
1 parent4f1e491 commitde9be56

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

‎doc/src/sgml/rules.sgml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/rules.sgml,v 1.47 2006/09/16 00:30:15 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/rules.sgml,v 1.48 2006/12/27 16:07:36 tgl Exp $ -->
22

33
<chapter id="rules">
44
<title>The Rule System</title>
@@ -649,21 +649,6 @@ SELECT shoe_ready.shoename, shoe_ready.sh_avail,
649649
collapsing the query tree is an optimization that the rewrite
650650
system doesn't have to concern itself with.
651651
</para>
652-
653-
<note>
654-
<para>
655-
There is currently no recursion stopping mechanism for view rules
656-
in the rule system (only for the other kinds of rules). This
657-
doesn't hurt much, because the only way to push this into an
658-
endless loop (bloating up the server process until it reaches the memory
659-
limit) is to create tables and then setup the view rules by hand
660-
with <command>CREATE RULE</command> in such a way, that one
661-
selects from the other that selects from the one. This could
662-
never happen if <command>CREATE VIEW</command> is used because for
663-
the first <command>CREATE VIEW</command>, the second relation does
664-
not exist and thus the first view cannot select from the second.
665-
</para>
666-
</note>
667652
</sect2>
668653

669654
<sect2>
@@ -688,7 +673,7 @@ SELECT shoe_ready.shoename, shoe_ready.sh_avail,
688673
<programlisting>
689674
SELECT t2.b FROM t1, t2 WHERE t1.a = t2.a;
690675

691-
UPDATE t1 SET b = t2.b WHERE t1.a = t2.a;
676+
UPDATE t1 SET b = t2.bFROM t2WHERE t1.a = t2.a;
692677
</programlisting>
693678

694679
are nearly identical. In particular:
@@ -730,7 +715,7 @@ UPDATE t1 SET b = t2.b WHERE t1.a = t2.a;
730715
as
731716

732717
<programlisting>
733-
UPDATE t1 SET a = t1.a, b = t2.b WHERE t1.a = t2.a;
718+
UPDATE t1 SET a = t1.a, b = t2.bFROM t2WHERE t1.a = t2.a;
734719
</programlisting>
735720

736721
and thus the executor run over the join will produce exactly the
@@ -756,11 +741,12 @@ SELECT t1.a, t2.b FROM t1, t2 WHERE t1.a = t2.a;
756741
To resolve this problem, another entry is added to the target list
757742
in <command>UPDATE</command> (and also in
758743
<command>DELETE</command>) statements: the current tuple ID
759-
(<acronym>CTID</>).<indexterm><primary>CTID</></> This is a system column containing the
744+
(<acronym>CTID</>).<indexterm><primary>CTID</></>
745+
This is a system column containing the
760746
file block number and position in the block for the row. Knowing
761747
the table, the <acronym>CTID</> can be used to retrieve the
762-
original row of <literal>t1</> to be updated. After adding the <acronym>CTID</>
763-
to the target list, the query actually looks like
748+
original row of <literal>t1</> to be updated. After adding the
749+
<acronym>CTID</>to the target list, the query actually looks like
764750

765751
<programlisting>
766752
SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a;
@@ -774,8 +760,7 @@ SELECT t1.a, t2.b, t1.ctid FROM t1, t2 WHERE t1.a = t2.a;
774760
<acronym>CTID</> pointed to, the <literal>cmax</> and
775761
<literal>xmax</> entries are set to the current command counter
776762
and current transaction ID. Thus the old row is hidden, and after
777-
the transaction committed the vacuum cleaner can really move it
778-
out.
763+
the transaction commits the vacuum cleaner can really remove it.
779764
</para>
780765

781766
<para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp