Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

Started by Alexey Bashtanovalmost 6 years ago11 messages
#1Alexey Bashtanov
bashtanov@imap.cc
1 attachment(s)

Hello,

Currently the documentation says that one can put "a list of table
expressions"
after FROM in UPDATE or after USING in DELETE.
However, "table expression" is defined as a complex of
FROM, WHERE, GROUP BY and HAVING clauses [1]https://www.postgresql.org/docs/devel/queries-table-expressions.html.
The thing one can list in the FROM clause in a comma-separated manner
is called a table reference [2]https://www.postgresql.org/docs/devel/queries-table-expressions.html#QUERIES-FROM.
SELECT reference does not use this term but explains what they could be [3]https://www.postgresql.org/docs/devel/sql-select.html#SQL-FROM.

Please could someone have a look at the patch attached?
It's not just pedantry but rather based on a real-life example of
someone reading and being not sure
whether e.g. joins can be used in there.

Best, Alex

[1]: https://www.postgresql.org/docs/devel/queries-table-expressions.html
[2]: https://www.postgresql.org/docs/devel/queries-table-expressions.html#QUERIES-FROM
https://www.postgresql.org/docs/devel/queries-table-expressions.html#QUERIES-FROM
[3]: https://www.postgresql.org/docs/devel/sql-select.html#SQL-FROM

Attachments:

doc_update_from_v1.difftext/x-patch; charset=UTF-8; name=doc_update_from_v1.diffDownload
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index df8cea48cf..3f9e067b47 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -120,9 +120,9 @@ DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
     <term><replaceable class="parameter">using_list</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
+      A list of table references, allowing columns from other tables
       to appear in the <literal>WHERE</literal> condition.  This is similar
-      to the list of tables that can be specified in the <xref
+      to the list of tables or other sources that can be specified in the <xref
       linkend="sql-from" endterm="sql-from-title"/> of a
       <command>SELECT</command> statement; for example, an alias for
       the table name can be specified.  Do not repeat the target table
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index f58dcd8877..44815cc654 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -167,10 +167,10 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
     <term><replaceable class="parameter">from_list</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
+      A list of table references, allowing columns from other tables
       to appear in the <literal>WHERE</literal> condition and the update
-      expressions. This is similar to the list of tables that can be
-      specified in the <xref linkend="sql-from"
+      expressions. This is similar to the list of tables or other sources
+      that can be specified in the <xref linkend="sql-from"
       endterm="sql-from-title"/> of a <command>SELECT</command>
       statement.  Note that the target table must not appear in the
       <replaceable>from_list</replaceable>, unless you intend a self-join (in which
#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Alexey Bashtanov (#1)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Thu, Feb 13, 2020 at 4:13 AM Alexey Bashtanov <bashtanov@imap.cc> wrote:

Hello,

Currently the documentation says that one can put "a list of table
expressions"
after FROM in UPDATE or after USING in DELETE.
However, "table expression" is defined as a complex of
FROM, WHERE, GROUP BY and HAVING clauses [1].
The thing one can list in the FROM clause in a comma-separated manner
is called a table reference [2].
SELECT reference does not use this term but explains what they could be
[3].

Please could someone have a look at the patch attached?
It's not just pedantry but rather based on a real-life example of
someone reading and being not sure
whether e.g. joins can be used in there.

Best, Alex

[1] https://www.postgresql.org/docs/devel/queries-table-expressions.html
[2]

https://www.postgresql.org/docs/devel/queries-table-expressions.html#QUERIES-FROM
[3] https://www.postgresql.org/docs/devel/sql-select.html#SQL-FROM

Drive-by comment - I'm on board with the idea but I do not believe this
patch accomplishes the goal.

IMO there is too much indirection happening and trying to get terms exactly
right, so the user can find or remember them from elsewhere in the
documentation, doesn't seem like the best solution. The material isn't
that extensive and since it is covered elsewhere a little bit more
explicitness in the DELETE and FROM documentation seems like a better path
forward.

David J.

#3David Fetter
david@fetter.org
In reply to: Alexey Bashtanov (#1)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Thu, Feb 13, 2020 at 11:13:32AM +0000, Alexey Bashtanov wrote:

Hello,

Currently the documentation says that one can put "a list of table
expressions"
after FROM in UPDATE or after USING in DELETE.
However, "table expression" is defined as a complex of
FROM, WHERE, GROUP BY and HAVING clauses [1].
The thing one can list in the FROM clause in a comma-separated manner
is called a table reference [2].
SELECT reference does not use this term but explains what they could be [3].

Please could someone have a look at the patch attached?
It's not just pedantry but rather based on a real-life example of someone
reading and being not sure
whether e.g. joins can be used in there.

Thanks for doing this!

Speaking of examples, there should be more of them illustrating some
of the cases you name.

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Thu, Feb 13, 2020 at 4:13 AM Alexey Bashtanov <bashtanov@imap.cc> wrote:

Please could someone have a look at the patch attached?
It's not just pedantry but rather based on a real-life example of
someone reading and being not sure
whether e.g. joins can be used in there.

Drive-by comment - I'm on board with the idea but I do not believe this
patch accomplishes the goal.
IMO there is too much indirection happening and trying to get terms exactly
right, so the user can find or remember them from elsewhere in the
documentation, doesn't seem like the best solution. The material isn't
that extensive and since it is covered elsewhere a little bit more
explicitness in the DELETE and FROM documentation seems like a better path
forward.

I see where you're coming from, but I do not think that repeating the
whole from_item syntax in UPDATE and DELETE is the best way forward.
In the first place, we'd inevitably forget to update those copies,
and in the second, I'm not sure that the syntax is all that helpful
without all the supporting text in the SELECT ref page --- which
surely we aren't going to duplicate.

I think the real problem with the places Alexey is on about is that
they're too waffle-y. They use wording like "similar to", leaving
one wondering what discrepancies exist but are being papered over.
In point of fact, as a look into gram.y will show, what you can
write after UPDATE ... FROM or DELETE ... USING is *exactly* the
same thing as what you can write after SELECT ... FROM. So what
I'm in favor of here is:

* Change the synopsis entries to look like "FROM from_item [, ...]"
and "USING from_item [, ...]", so that they match the SELECT
synopsis exactly.

* In the text, describe from_item as being exactly the same as
it is in SELECT.

(Compare the handling of with_query, which has pretty much the
same problem of being way too complex to document three times.)

regards, tom lane

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#4)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Thu, Feb 13, 2020 at 9:26 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Thu, Feb 13, 2020 at 4:13 AM Alexey Bashtanov <bashtanov@imap.cc>

wrote:

Please could someone have a look at the patch attached?
It's not just pedantry but rather based on a real-life example of
someone reading and being not sure
whether e.g. joins can be used in there.

Drive-by comment - I'm on board with the idea but I do not believe this
patch accomplishes the goal.
IMO there is too much indirection happening and trying to get terms

exactly

right, so the user can find or remember them from elsewhere in the
documentation, doesn't seem like the best solution. The material isn't
that extensive and since it is covered elsewhere a little bit more
explicitness in the DELETE and FROM documentation seems like a better

path

forward.

I see where you're coming from, but I do not think that repeating the
whole from_item syntax in UPDATE and DELETE is the best way forward.
In the first place, we'd inevitably forget to update those copies,
and in the second, I'm not sure that the syntax is all that helpful
without all the supporting text in the SELECT ref page --- which
surely we aren't going to duplicate.

I think the real problem with the places Alexey is on about is that
they're too waffle-y. They use wording like "similar to", leaving
one wondering what discrepancies exist but are being papered over.
In point of fact, as a look into gram.y will show, what you can
write after UPDATE ... FROM or DELETE ... USING is *exactly* the
same thing as what you can write after SELECT ... FROM. So what
I'm in favor of here is:

* Change the synopsis entries to look like "FROM from_item [, ...]"
and "USING from_item [, ...]", so that they match the SELECT
synopsis exactly.

* In the text, describe from_item as being exactly the same as
it is in SELECT.

+1

I didn't want a wholesale repetition but the whole "similar to" piece is
indeed my issue and this addresses it sufficiently.

David J.

#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
1 attachment(s)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Thu, Feb 13, 2020 at 11:26:45AM -0500, Tom Lane wrote:

I see where you're coming from, but I do not think that repeating the
whole from_item syntax in UPDATE and DELETE is the best way forward.
In the first place, we'd inevitably forget to update those copies,
and in the second, I'm not sure that the syntax is all that helpful
without all the supporting text in the SELECT ref page --- which
surely we aren't going to duplicate.

I think the real problem with the places Alexey is on about is that
they're too waffle-y. They use wording like "similar to", leaving
one wondering what discrepancies exist but are being papered over.
In point of fact, as a look into gram.y will show, what you can
write after UPDATE ... FROM or DELETE ... USING is *exactly* the
same thing as what you can write after SELECT ... FROM. So what
I'm in favor of here is:

* Change the synopsis entries to look like "FROM from_item [, ...]"
and "USING from_item [, ...]", so that they match the SELECT
synopsis exactly.

* In the text, describe from_item as being exactly the same as
it is in SELECT.

(Compare the handling of with_query, which has pretty much the
same problem of being way too complex to document three times.)

I have implemented the ideas above in the attached patch. I have
synchronized the syntax to match SELECT, and synchronized the paragraphs
describing the item.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

Attachments:

from.difftext/x-diff; charset=us-asciiDownload
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index df8cea48cf..9f0ef0e681 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -23,7 +23,7 @@ PostgreSQL documentation
 <synopsis>
 [ WITH [ RECURSIVE ] <replaceable class="parameter">with_query</replaceable> [, ...] ]
 DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> ]
-    [ USING <replaceable class="parameter">using_list</replaceable> ]
+    [ USING <replaceable class="parameter">using_item</replaceable> [, ...] ]
     [ WHERE <replaceable class="parameter">condition</replaceable> | WHERE CURRENT OF <replaceable class="parameter">cursor_name</replaceable> ]
     [ RETURNING * | <replaceable class="parameter">output_expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...] ]
 </synopsis>
@@ -117,17 +117,18 @@ DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
    </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">using_list</replaceable></term>
+    <term><replaceable class="parameter">using_item</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
-      to appear in the <literal>WHERE</literal> condition.  This is similar
-      to the list of tables that can be specified in the <xref
-      linkend="sql-from" endterm="sql-from-title"/> of a
-      <command>SELECT</command> statement; for example, an alias for
-      the table name can be specified.  Do not repeat the target table
-      in the <replaceable class="parameter">using_list</replaceable>,
-      unless you wish to set up a self-join.
+      A table expression allowing columns from other tables to appear
+      in the <literal>WHERE</literal> condition.  This is the same as
+      the table that can be specified in the <xref linkend="sql-from"
+      endterm="sql-from-title"/> of a <command>SELECT</command>
+      statement; for example, an alias for the table name can be
+      specified.  Do not repeat the target table as a <replaceable
+      class="parameter">using_item</replaceable> unless you wish to set
+      up a self-join (in which case it must appear with an alias in the
+      <replaceable>using_item</replaceable>).
      </para>
     </listitem>
    </varlistentry>
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index f58dcd8877..d1e74a7c3b 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -27,7 +27,7 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
           ( <replaceable class="parameter">column_name</replaceable> [, ...] ) = [ ROW ] ( { <replaceable class="parameter">expression</replaceable> | DEFAULT } [, ...] ) |
           ( <replaceable class="parameter">column_name</replaceable> [, ...] ) = ( <replaceable class="parameter">sub-SELECT</replaceable> )
         } [, ...]
-    [ FROM <replaceable class="parameter">from_list</replaceable> ]
+    [ FROM <replaceable class="parameter">from_item</replaceable> [, ...] ]
     [ WHERE <replaceable class="parameter">condition</replaceable> | WHERE CURRENT OF <replaceable class="parameter">cursor_name</replaceable> ]
     [ RETURNING * | <replaceable class="parameter">output_expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...] ]
 </synopsis>
@@ -164,17 +164,18 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
    </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">from_list</replaceable></term>
+    <term><replaceable class="parameter">from_item</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
-      to appear in the <literal>WHERE</literal> condition and the update
-      expressions. This is similar to the list of tables that can be
-      specified in the <xref linkend="sql-from"
-      endterm="sql-from-title"/> of a <command>SELECT</command>
-      statement.  Note that the target table must not appear in the
-      <replaceable>from_list</replaceable>, unless you intend a self-join (in which
-      case it must appear with an alias in the <replaceable>from_list</replaceable>).
+      A table expression allowing columns from other tables to
+      appear in the <literal>WHERE</literal> condition and update
+      expressions. This is the same as the table that can be specified
+      in the <xref linkend="sql-from" endterm="sql-from-title"/> of a
+      <command>SELECT</command> statement; for example, an alias for
+      the table name can be specified.  Do not repeat the target table
+      as a <replaceable>from_item</replaceable> unless you intend a
+      self-join (in which case it must appear with an alias in the
+      <replaceable>from_item</replaceable>).
      </para>
     </listitem>
    </varlistentry>
@@ -264,7 +265,7 @@ UPDATE <replaceable class="parameter">count</replaceable>
   <para>
    When a <literal>FROM</literal> clause is present, what essentially happens
    is that the target table is joined to the tables mentioned in the
-   <replaceable>from_list</replaceable>, and each output row of the join
+   <replaceable>from_item</replaceable> list, and each output row of the join
    represents an update operation for the target table.  When using
    <literal>FROM</literal> you should ensure that the join
    produces at most one output row for each row to be modified.  In
#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#6)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

Bruce Momjian <bruce@momjian.us> writes:

I have implemented the ideas above in the attached patch. I have
synchronized the syntax to match SELECT, and synchronized the paragraphs
describing the item.

I think that the DELETE synopsis should look like

[ USING <replaceable class="parameter">from_item</replaceable> [, ...] ]

so that there's not any question which part of the SELECT syntax we're
talking about. I also think that the running text in both cases should
say in exactly these words "from_item means the same thing as it does
in SELECT"; the wording you propose still seems to be dancing around
the point, leaving readers perhaps not quite sure about what is meant.

In the DELETE case you could alternatively say "using_item means the same
thing as from_item does in SELECT", but that doesn't really seem like an
improvement to me.

regards, tom lane

#8Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#7)
1 attachment(s)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Tue, Mar 17, 2020 at 10:58:54PM -0400, Tom Lane wrote:

Bruce Momjian <bruce@momjian.us> writes:

I have implemented the ideas above in the attached patch. I have
synchronized the syntax to match SELECT, and synchronized the paragraphs
describing the item.

I think that the DELETE synopsis should look like

[ USING <replaceable class="parameter">from_item</replaceable> [, ...] ]

so that there's not any question which part of the SELECT syntax we're
talking about. I also think that the running text in both cases should
say in exactly these words "from_item means the same thing as it does
in SELECT"; the wording you propose still seems to be dancing around
the point, leaving readers perhaps not quite sure about what is meant.

In the DELETE case you could alternatively say "using_item means the same
thing as from_item does in SELECT", but that doesn't really seem like an
improvement to me.

OK, updated patch attached.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

Attachments:

from.difftext/x-diff; charset=us-asciiDownload
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index df8cea48cf..08fb032b50 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -23,7 +23,7 @@ PostgreSQL documentation
 <synopsis>
 [ WITH [ RECURSIVE ] <replaceable class="parameter">with_query</replaceable> [, ...] ]
 DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> ]
-    [ USING <replaceable class="parameter">using_list</replaceable> ]
+    [ USING <replaceable class="parameter">from_item</replaceable> [, ...] ]
     [ WHERE <replaceable class="parameter">condition</replaceable> | WHERE CURRENT OF <replaceable class="parameter">cursor_name</replaceable> ]
     [ RETURNING * | <replaceable class="parameter">output_expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...] ]
 </synopsis>
@@ -117,17 +117,17 @@ DELETE FROM [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
    </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">using_list</replaceable></term>
+    <term><replaceable class="parameter">from_item</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
-      to appear in the <literal>WHERE</literal> condition.  This is similar
-      to the list of tables that can be specified in the <xref
-      linkend="sql-from" endterm="sql-from-title"/> of a
-      <command>SELECT</command> statement; for example, an alias for
-      the table name can be specified.  Do not repeat the target table
-      in the <replaceable class="parameter">using_list</replaceable>,
-      unless you wish to set up a self-join.
+      A table expression allowing columns from other tables to appear
+      in the <literal>WHERE</literal> condition.  This uses the same
+      syntax as the <xref linkend="sql-from" endterm="sql-from-title"/>
+      of a <command>SELECT</command> statement; for example, an alias
+      for the table name can be specified.  Do not repeat the target
+      table as a <replaceable class="parameter">from_item</replaceable>
+      unless you wish to set up a self-join (in which case it must appear
+      with an alias in the <replaceable>from_item</replaceable>).
      </para>
     </listitem>
    </varlistentry>
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index f58dcd8877..07958e7447 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -27,7 +27,7 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
           ( <replaceable class="parameter">column_name</replaceable> [, ...] ) = [ ROW ] ( { <replaceable class="parameter">expression</replaceable> | DEFAULT } [, ...] ) |
           ( <replaceable class="parameter">column_name</replaceable> [, ...] ) = ( <replaceable class="parameter">sub-SELECT</replaceable> )
         } [, ...]
-    [ FROM <replaceable class="parameter">from_list</replaceable> ]
+    [ FROM <replaceable class="parameter">from_item</replaceable> [, ...] ]
     [ WHERE <replaceable class="parameter">condition</replaceable> | WHERE CURRENT OF <replaceable class="parameter">cursor_name</replaceable> ]
     [ RETURNING * | <replaceable class="parameter">output_expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...] ]
 </synopsis>
@@ -164,17 +164,17 @@ UPDATE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [
    </varlistentry>
 
    <varlistentry>
-    <term><replaceable class="parameter">from_list</replaceable></term>
+    <term><replaceable class="parameter">from_item</replaceable></term>
     <listitem>
      <para>
-      A list of table expressions, allowing columns from other tables
-      to appear in the <literal>WHERE</literal> condition and the update
-      expressions. This is similar to the list of tables that can be
-      specified in the <xref linkend="sql-from"
-      endterm="sql-from-title"/> of a <command>SELECT</command>
-      statement.  Note that the target table must not appear in the
-      <replaceable>from_list</replaceable>, unless you intend a self-join (in which
-      case it must appear with an alias in the <replaceable>from_list</replaceable>).
+      A table expression allowing columns from other tables to appear in
+      the <literal>WHERE</literal> condition and update expressions. This
+      uses the same syntax as the <xref linkend="sql-from"
+      endterm="sql-from-title"/> of a <command>SELECT</command> statement;
+      for example, an alias for the table name can be specified.  Do not
+      repeat the target table as a <replaceable>from_item</replaceable>
+      unless you intend a self-join (in which case it must appear with
+      an alias in the <replaceable>from_item</replaceable>).
      </para>
     </listitem>
    </varlistentry>
@@ -264,7 +264,7 @@ UPDATE <replaceable class="parameter">count</replaceable>
   <para>
    When a <literal>FROM</literal> clause is present, what essentially happens
    is that the target table is joined to the tables mentioned in the
-   <replaceable>from_list</replaceable>, and each output row of the join
+   <replaceable>from_item</replaceable> list, and each output row of the join
    represents an update operation for the target table.  When using
    <literal>FROM</literal> you should ensure that the join
    produces at most one output row for each row to be modified.  In
#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#8)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

Bruce Momjian <bruce@momjian.us> writes:

OK, updated patch attached.

LGTM, thanks.

regards, tom lane

#10David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#9)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Wednesday, March 18, 2020, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Bruce Momjian <bruce@momjian.us> writes:

OK, updated patch attached.

LGTM, thanks

+1

David J.

#11Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#8)
Re: Small docs bugfix: make it clear what can be used in UPDATE FROM and DELETE USING

On Wed, Mar 18, 2020 at 12:24:45PM -0400, Bruce Momjian wrote:

On Tue, Mar 17, 2020 at 10:58:54PM -0400, Tom Lane wrote:

Bruce Momjian <bruce@momjian.us> writes:

I have implemented the ideas above in the attached patch. I have
synchronized the syntax to match SELECT, and synchronized the paragraphs
describing the item.

I think that the DELETE synopsis should look like

[ USING <replaceable class="parameter">from_item</replaceable> [, ...] ]

so that there's not any question which part of the SELECT syntax we're
talking about. I also think that the running text in both cases should
say in exactly these words "from_item means the same thing as it does
in SELECT"; the wording you propose still seems to be dancing around
the point, leaving readers perhaps not quite sure about what is meant.

In the DELETE case you could alternatively say "using_item means the same
thing as from_item does in SELECT", but that doesn't really seem like an
improvement to me.

OK, updated patch attached.

Patch appied through 9.5.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +