On Sun, Jul 13, 2025 at 2:57 PM Tom Lane <t...@sss.pgh.pa.us> wrote:
> ... so concretely, about like this? > > We seldom if ever resort to including descriptions involving the fe/be protocol in the SQL portion of the documentation - rightly considering (IMO) those to be implementation details (e.g., we don't even directly mention simple protocol in "psql -c" - though we do link to it under "multi-statement commands"). Is there no way to avoid that here? I'd be ok if we'd limit this to a distinction between the simple protocol and the extended protocol since, as a volatile function, it isn't even like statement_timestamp can be seen in extended protocol aside from when execute is sent. So the special case where it doesn't behave as expected is a simple protocol multi-statement command. An example in psql would serve to make this much more clear than any wording can do. Possibly added here or as part of the existing documentation that 'psql -c' points to [1]. Which probably could be pointed to from here as well. Seems also like maybe SPI should be mentioned explicitly here since it seems to act like a client in a relevant way. I'm assuming a statement_timestamp executed within a function will return the same timestamp the calling statement would. David J. [1] https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT