From 1d763d9107eda2db054d0f7edee4c2e9b55dfacf Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Sun, 22 Jan 2006 05:20:35 +0000 Subject: Allow an optional alias for the target table to be specified for UPDATE and DELETE. If specified, the alias must be used instead of the full table name. Also, the alias currently cannot be used in the SET clause of UPDATE. Patch from Atsushi Ogawa, various editorialization by Neil Conway. Along the way, make the rowtypes regression test pass if add_missing_from is enabled, and add a new (skeletal) regression test for DELETE. --- doc/src/sgml/ref/delete.sgml | 17 +++++++++++++++-- doc/src/sgml/ref/update.sgml | 20 ++++++++++++++++++-- doc/src/sgml/regress.sgml | 4 ++-- 3 files changed, 35 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml index 8369d991372..b61e6cacd21 100644 --- a/doc/src/sgml/ref/delete.sgml +++ b/doc/src/sgml/ref/delete.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,7 @@ PostgreSQL documentation -DELETE FROM [ ONLY ] table +DELETE FROM [ ONLY ] table [ [ AS ] alias ] [ USING usinglist ] [ WHERE condition ] @@ -91,6 +91,19 @@ DELETE FROM [ ONLY ] table + + alias + + + A substitute name for the target table. When an alias is + provided, it completely hides the actual name of the table. For + example, given DELETE FROM foo AS f, the remainder + of the DELETE statement must refer to this + table as f not foo. + + + + usinglist diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 503f41de12b..95e4310ab42 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -1,5 +1,5 @@ @@ -20,7 +20,8 @@ PostgreSQL documentation -UPDATE [ ONLY ] table SET column = { expression | DEFAULT } [, ...] +UPDATE [ ONLY ] table [ [ AS ] alias ] + SET column = { expression | DEFAULT } [, ...] [ FROM fromlist ] [ WHERE condition ] @@ -73,6 +74,21 @@ UPDATE [ ONLY ] table SET + + alias + + + A substitute name for the target table. When an alias is + provided, it completely hides the actual name of the table. For + example, given UPDATE foo AS f, the remainder of the + UPDATE statement must refer to this table as + f not foo. You cannot use the alias in + the SET clause. For example, SET + f.col = 1 is invalid. + + + + column diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml index 05749a3157b..11f9468860f 100644 --- a/doc/src/sgml/regress.sgml +++ b/doc/src/sgml/regress.sgml @@ -1,4 +1,4 @@ - + Regression Tests @@ -49,7 +49,7 @@ gmake check ====================== - All 98 tests passed. + All 100 tests passed. ====================== -- cgit v1.2.3