From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | zacharymschultz(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Minor typo in 13.3.5. Advisory Locks |
Date: | 2023-03-31 20:43:38 |
Message-ID: | 39D8E7F1-7B33-42E9-9BE2-554AAB1006C6@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
> On 31 Mar 2023, at 14:35, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> Reading this section I agree that the mix of ok/danger in the same example can
>> be tad misleading though. Something like the attached is what I would prefer
>> as a reader.
>
> I think in your rewrite, "this query" is dangling a bit because there's
> several sentences more before the query actually appears. I suggest
> ordering things more like:
>
> expressions are evaluated. For example,
> this query is dangerous because the
> <literal>LIMIT</literal> is not guaranteed to be applied before the locking
> function is executed:
> <screen>
> SELECT pg_advisory_lock(id) FROM foo WHERE id > 12345 LIMIT 100; -- danger!
> </screen>
> This might cause some locks to be acquired
> that the application was not expecting, and hence would fail to
> ...
> On the other hand, these queries are safe:
> <screen>
> SELECT pg_advisory_lock(id) FROM foo WHERE id = 12345; -- ok
> ...
Yes, I like this version a lot better than what I proposed.
> Separately from that: now that I look at this example, it's really
> quite safe for any plausible plan shape. It used to be dangerous if
> you had an ORDER BY, but there's no ORDER BY, and even if there were
> we fixed that in 9118d03a8. Do we want to choose another example, and
> if so what? The "not guaranteed" wording isn't really wrong, but an
> example that doesn't do what we're saying it does isn't good either.
Off the cuff I don't have any better suggestions, need to do some more
thinking.
--
Daniel Gustafsson
From | Date | Subject | |
---|---|---|---|
Next Message | PG Doc comments form | 2023-03-31 22:17:11 | Correction: Postgres emum documentation 8.7.4 should read 63 characters (instead of bytes) |
Previous Message | Tom Lane | 2023-03-31 12:35:55 | Re: Minor typo in 13.3.5. Advisory Locks |