pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SELECT ... FOR UPDATE OF
3+ messages / 3 participants
[nested] [flat]

* SELECT ... FOR UPDATE OF
@ 2020-12-17 11:00 PG Doc comments form <noreply@postgresql.org>
  2020-12-17 15:08 ` Re: SELECT ... FOR UPDATE OF David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2020-12-17 11:00 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: at.light@live.com.au

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.

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.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: SELECT ... FOR UPDATE OF
  2020-12-17 11:00 SELECT ... FOR UPDATE OF PG Doc comments form <noreply@postgresql.org>
@ 2020-12-17 15:08 ` David G. Johnston <david.g.johnston@gmail.com>
  2020-12-17 22:39   ` RE: SELECT ... FOR UPDATE OF Alan Thomas <at.light@live.com.au>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2020-12-17 15:08 UTC (permalink / raw)
  To: at.light@live.com.au, Pg Docs <pgsql-docs@lists.postgresql.org>

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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* RE: SELECT ... FOR UPDATE OF
  2020-12-17 11:00 SELECT ... FOR UPDATE OF PG Doc comments form <noreply@postgresql.org>
  2020-12-17 15:08 ` Re: SELECT ... FOR UPDATE OF David G. Johnston <david.g.johnston@gmail.com>
@ 2020-12-17 22:39   ` Alan Thomas <at.light@live.com.au>
  0 siblings, 0 replies; 3+ messages in thread

From: Alan Thomas @ 2020-12-17 22:39 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; Pg Docs <pgsql-docs@lists.postgresql.org>

Hi David,

Thanks for responding.

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

I see – thanks for pointing it out.

It would be good if this sentence actually referred to "OF" by name. The section on locking clauses is long and densely written, and a direct mention of the syntax element would help the reader find the relevant information.

Even an example using FOR UPDATE OF ... might be a useful addition.

> I'll agree that the docs don't indicate that "table_name" has to be unqualified.

We shouldn't need to work things out by guesswork / resolving error messages. This should be in the docs so we can get it right the first time.

Thanks,
Alan

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-12-17 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 11:00 SELECT ... FOR UPDATE OF PG Doc comments form <noreply@postgresql.org>
2020-12-17 15:08 ` David G. Johnston <david.g.johnston@gmail.com>
2020-12-17 22:39   ` Alan Thomas <at.light@live.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox