pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Undo decision to allow pg_proc.prosrc to be NULL.
Date: Thu, 15 Apr 2021 21:19:02 +0000
Message-ID: <E1lX9OA-0003OY-Rm@gemulon.postgresql.org> (raw)

Undo decision to allow pg_proc.prosrc to be NULL.

Commit e717a9a18 changed the longstanding rule that prosrc is NOT NULL
because when a SQL-language function is written in SQL-standard style,
we don't currently have anything useful to put there.  This seems a poor
decision though, as it could easily have negative impacts on external
PLs (opening them to crashes they didn't use to have, for instance).
SQL-function-related code can just as easily test "is prosqlbody not
null" as "is prosrc null", so there's no real gain there either.
Hence, revert the NOT NULL marking removal and adjust related logic.

For now, we just put an empty string into prosrc for SQL-standard
functions.  Maybe we'll have a better idea later, although the
history of things like pg_attrdef.adsrc suggests that it's not
easy to maintain a string equivalent of a node tree.

This also adds an assertion that queryDesc->sourceText != NULL
to standard_ExecutorStart.  We'd been silently relying on that
for awhile, so let's make it less silent.

Also fix some overlooked documentation and test cases.

Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1111b2668d89bfcb6f502789158b1233ab4217a6

Modified Files
--------------
doc/src/sgml/catalogs.sgml                      | 16 ++++--
src/backend/catalog/pg_proc.c                   | 31 +++++-------
src/backend/commands/functioncmds.c             | 11 ++++-
src/backend/executor/execMain.c                 |  2 +
src/backend/executor/functions.c                | 20 ++++----
src/backend/optimizer/util/clauses.c            | 66 ++++++++++++-------------
src/bin/pg_dump/pg_dump.c                       |  2 +-
src/bin/psql/describe.c                         |  2 +-
src/include/catalog/catversion.h                |  2 +-
src/include/catalog/pg_proc.h                   |  2 +-
src/include/executor/functions.h                |  5 +-
src/test/regress/expected/create_function_3.out |  6 +++
src/test/regress/expected/opr_sanity.out        | 11 ++++-
src/test/regress/sql/create_function_3.sql      |  5 ++
src/test/regress/sql/opr_sanity.sql             |  7 ++-
15 files changed, 109 insertions(+), 79 deletions(-)



Message-ID: <E1lX9OA-0003OY-Rm@gemulon.postgresql.org>
Permalink:  ../E1lX9OA-0003OY-Rm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lX9OA-0003OY-Rm@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Undo decision to allow pg_proc.prosrc to be NULL.
  In-Reply-To: <E1lX9OA-0003OY-Rm@gemulon.postgresql.org>
  References: <E1lX9OA-0003OY-Rm@gemulon.postgresql.org>

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

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