pgsql: Don't create a shell type for function returning an array

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't create a shell type for function returning an array
Date: 2026-08-27 12:06:35
Message-ID: E1wzYsL-00000002Kzl-47h0@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't create a shell type for function returning an array

Refactor the checks in the function to move all the conditions for
when to attempt creating a shell type into one place. Add a check for
the array syntax.

In addition to rejecting array syntax, another user-visible effect is
that the error message is now different if the type specified a
typmod. You now get "type does not exist" instead of the more
specific "type modifier cannot be specified for shell type". That
seems better; the implicit shell type creation exists only for
backwards compatibility, and it never worked with type modifiers, so
if there's a type modifier it's most likely not because the user tried
to create a shell type,

Add test for the array syntax, the type modifier, and some other cases
for which we don't create shell types.

Discussion: https://www.postgresql.org/message-id/de673feb-41b4-4685-b24b-6408b95e58ab@iki.fi
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2866d8c7dbfc9d882a7d80fef93fbbe763709932

Modified Files
--------------
src/backend/commands/functioncmds.c | 58 +++++++++++++++++++------------
src/test/regress/expected/create_type.out | 50 +++++++++++++++++++++++++-
src/test/regress/sql/create_type.sql | 42 ++++++++++++++++++++++
3 files changed, 126 insertions(+), 24 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-08-27 14:43:09 pgsql: Report specific SQLSTATEs for stats restore errors
Previous Message Peter Eisentraut 2026-08-27 09:58:58 pgsql: Fix pg_event_trigger_ddl_commands for GRANT ON PROPERTY GRAPH