Re: please define 'statement' in the glossary

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, petermittere(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: please define 'statement' in the glossary
Date: 2025-07-14 16:19:41
Message-ID: CAKFQuwa2gDZTJm5hkrqubcn1=A3aTDR7HxX-NfF-9fKrp28f+A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, Jul 14, 2025 at 9:08 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Cannot readily test this presently but I wonder what the following
> produces:
>
> > psql -c "begin; select statement_timestamp(), transaction_timestamp();
> > select statement_timestamp(), transaction_timestamp(); commit; begin;
> > select statement_timestamp(), transaction_timestamp(); commit;"
>
> > Transaction timestamp should progress while statement timestamp should
> not,
> > right?
>
> AFAICT neither one progresses. I think the reason is that (1)
> statement timestamp is set by arrival of the command message
> and (2) transaction timestamp is set by copying statement timestamp
> at the moment of beginning a transaction.
>
>
Ok. That explains why "statement_timestamp() and transaction_timestamp()
return the same value during the first command of a transaction," isn't
just stating the obvious. transaction_timestamp() literally returns the
value statement_timestamp().

But when talking about current_timestamp first and saying "Since these
functions return the start time of the current transaction" it does read
more as coincidence as opposed to definition.

I'm fine with this entire section assuming/stating that extended protocol
is in effect and that 53.2.2.1 explains how these behave when executing a
multi-statement simple protocol "script".

David J.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Fujii Masao 2025-07-14 16:51:30 Re: Clarify VACUUM FULL exclusion in total_vacuum_time docs
Previous Message Tom Lane 2025-07-14 16:08:46 Re: please define 'statement' in the glossary