Re: Possible mismatch between behaviour and documentation in CREATE FUNCTION

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Isaac Morland <isaac.morland@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-11T03:53:39Z
Lists: pgsql-hackers
On Friday, April 10, 2026, Isaac Morland <isaac.morland@gmail.com> wrote:

> The documentation says that only BEGIN ATOMIC parses the function body at
> definition time. Whereas AS parses the function body at execution time:
>
> https://www.postgresql.org/docs/current/sql-createfunction.html
>
> (and look at the explanation of sql_body)
>

Possibly some documentation tweaks are in order.  I haven’t looked at it in
depth.  The optional checks are able to be disabled:

https://www.postgresql.org/docs/current/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-STATEMENT

While the result of the required parsing of a function body is implying
that such parsing is saved to the catalogs so that creation-time object
references are retained.  While the others are re-parsed during execution
and object references retained only for the lifetime of the query.

David J.