| From: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Reject WAIT FOR earlier in transaction-snapshot mode |
| Date: | 2026-09-17 01:42:48 |
| Message-ID: | CAN12+YJPw+9T1N2uzWeiyJSzRR5mwafvsnat_GeCWOGPQkhQ6A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> I went through this thread. I don't quite agree with the proposed
> patch. I think construction like
>
> BEGIN ISOLATION LEVEL ... ; WAIT FOR LSN ...; do the work
>
> should work at any isolation level. v4 patch makes it work with READ
> COMMITTED, but fail with higher levels. I think this is undesired
> asymmetry.
I don't think there is a good use-case here where someone will do:
BEGIN ISOLATION LEVEL REPEATBLE READ; WAIT FOR LSN ...;
SELECT ...
but, perhaps it's better to be more flexible here. So, I'm ok with proceeding
with your suggestion.
> I suggest we should better fix the docs. The attached v5 patch does
> it. Additionally it makes errdetail() about the isolation level
> conditional and shown only on isolation levels higher than READ
> COMMITTED.
The existing error message is:
```
errmsg("WAIT must be called without an active or registered snapshot")
```
and v5 uses the same terminology in the documentation:
```
<command>DO</command> block. It also requires that no active or
registered snapshot be held.
```
The terms "active snapshot" and "registered snapshot" describe internal
snapshot states, and don't seem appropriate for user-facing docs/error
messages.
For example, the COPY documentation instead refers to "snapshots held
by this transaction".
Could we instead use:
```
errmsg("WAIT cannot be executed while the current transaction
holds a snapshot")
```
and change the documentation to:
```
<command>DO</command> block. It also cannot be executed while the
current transaction holds a snapshot. A transaction running at an
isolation level higher than <literal>READ COMMITTED</literal> holds
one from its first query until it ends ....
```
--
Sami Imseih
Amazon Web Services (AWS)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | ZizhuanLiu X-MAN | 2026-09-17 02:01:24 | Re: Optimize MCV stats for sortable types and utilize sorted-order properties |
| Previous Message | Bharath Rupireddy | 2026-09-17 01:37:13 | Re: [PATCH] Release replication slot on error in SQL-callable slot functions |