pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't create a shell type for function returning an array
Date: Thu, 27 Aug 2026 12:06:35 +0000
Message-ID: <E1wzYsM-00000002Kzp-06Kq@gemulon.postgresql.org> (raw)

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
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b90eeb29eea0cdbec236abc9fbdf8f448c26f929

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(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1wzYsM-00000002Kzp-06Kq@gemulon.postgresql.org>
Permalink:  ../E1wzYsM-00000002Kzp-06Kq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wzYsM-00000002Kzp-06Kq@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Don't create a shell type for function returning an array
  In-Reply-To: <E1wzYsM-00000002Kzp-06Kq@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