Re: Possible mismatch between behaviour and documentation in CREATE FUNCTION

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Possible mismatch between behaviour and documentation in CREATE FUNCTION
Date: 2026-04-11 03:53:39
Message-ID: CAKFQuwYX7a5A=Kg3xtsGq51Jqe5VWLNH9Dos-LxvVwFgQJ5Hwg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, April 10, 2026, Isaac Morland <isaac(dot)morland(at)gmail(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message SATYANARAYANA NARLAPURAM 2026-04-11 03:57:50 Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter
Previous Message Isaac Morland 2026-04-11 03:40:10 Possible mismatch between behaviour and documentation in CREATE FUNCTION