Re: SELECT ... FOR UPDATE OF

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: at(dot)light(at)live(dot)com(dot)au, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: SELECT ... FOR UPDATE OF
Date: 2020-12-17 15:08:57
Message-ID: CAKFQuwZUdfKqSp+cw+ezGbg9L+=bjFdmDshai2YWWCJmcPSPow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, Dec 17, 2020 at 5:29 AM PG Doc comments form <noreply(at)postgresql(dot)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.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2020-12-17 15:11:07 Re: The sub-categories do not have anchors on this page
Previous Message Bruce Momjian 2020-12-17 15:01:50 Re: The sub-categories do not have anchors on this page