Re: SELECT ... FOR UPDATE OF - Mailing list pgsql-docs

From David G. Johnston
Subject Re: SELECT ... FOR UPDATE OF
Date
Msg-id CAKFQuwZUdfKqSp+cw+ezGbg9L+=bjFdmDshai2YWWCJmcPSPow@mail.gmail.com
Whole thread Raw
In response to SELECT ... FOR UPDATE OF  (PG Doc comments form <noreply@postgresql.org>)
Responses RE: SELECT ... FOR UPDATE OF
List pgsql-docs
On Thu, Dec 17, 2020 at 5:29 AM PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/sql-select.html
Description:

The FOR UPDATE clause of the SELECT statement can be followed by an OF
clause, but this is never explained at all in the documentation, as far as I
can tell. What does it do? This needs to be written down.

It is.  "If specific tables are named in a locking clause, then only rows coming from those tables are locked;"


For example, when attempting to use the OF clause in a particular query, I
get the error "FOR UPDATE must specify unqualified relation names". The
documentation doesn't provide enough information for me to understand what I
have done wrong, so I will have to use trial and error to solve my problem.

A relation name is qualified if it has a schema in front of it.  I'll agree that the docs don't indicate that "table_name" has to be unqualified.  But mostly the OF clause points to the relations named within the query itself, not to the original relation as recorded in the catalog.

David J.

pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: The sub-categories do not have anchors on this page
Next
From: "David G. Johnston"
Date:
Subject: Re: The sub-categories do not have anchors on this page