public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: not fully correct error message
Date: Thu, 1 Jan 2026 18:05:12 +0800
Message-ID: <CACJufxEOQ+2=L3aLBzW6A4vu75gN7vKw07+QgU_398Avqb5KTg@mail.gmail.com> (raw)
In-Reply-To: <CAFj8pRCveWPR06bbad9GnMb0Kcr6jnXPttv9XOaOB+oFCD1Tsg@mail.gmail.com>
References: <CAFj8pRCveWPR06bbad9GnMb0Kcr6jnXPttv9XOaOB+oFCD1Tsg@mail.gmail.com>

On Thu, Jan 1, 2026 at 3:10 PM Pavel Stehule <[email protected]> wrote:
>
> Hi
>
> I tested one use case, and maybe I found little bit possible error message
>
> create procedure test()
> as $$
> begin
>   vacuum;
> end;
> $$ language plpgsql;
>
> (2026-01-01 08:04:05) postgres=# call test();
> ERROR:  25001: VACUUM cannot be executed from a function
> CONTEXT:  SQL statement "vacuum"
> PL/pgSQL function test() line 3 at SQL statement
> LOCATION:  PreventInTransactionBlock, xact.c:3695
> (2026-01-01 08:09:18) postgres=#
>
> should be "VACUUM cannot be executed from a function or a procedure" instead ?
>

hi.
"VACUUM cannot be executed from a function or a procedure"
looks good to me.

similarly, in ExecWaitStmt we have:
        ereport(ERROR,
                errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                errmsg("WAIT FOR must be only called without an active
or registered snapshot"),
                errdetail("WAIT FOR cannot be executed from a function
or a procedure or within a transaction with an isolation level higher
than READ COMMITTED."));

PreventInTransactionBlock is used in so many places, but this error message:
``
(errmsg("%s cannot be executed from a function", stmtType)));
``
only appears once in the regress tests.
maybe we can add some dummy tests for it.






view thread (10+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: not fully correct error message
  In-Reply-To: <CACJufxEOQ+2=L3aLBzW6A4vu75gN7vKw07+QgU_398Avqb5KTg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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