Обсуждение: pgsql: Allow RECORD and RECORD[] to be specified in functioncoldeflist

Поиск
Список
Период
Сортировка

pgsql: Allow RECORD and RECORD[] to be specified in functioncoldeflist

От
Tom Lane
Дата:
Allow RECORD and RECORD[] to be specified in function coldeflists.

We can't allow these pseudo-types to be used as table column types,
because storing an anonymous record value in a table would result
in data that couldn't be understood by other sessions.  However,
it seems like there's no harm in allowing the case in a column
definition list that's specifying what a function-returning-record
returns.  The data involved is all local to the current session,
so we should be just as able to resolve its actual tuple type as
we are for the function-returning-record's top-level tuple output.

Elvis Pranskevichus, with cosmetic changes by me

Discussion: https://postgr.es/m/11038447.kQ5A9Uj5xi@hammer.magicstack.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5f5c01459053c0975b89b5aa1a3d705e677348ae

Modified Files
--------------
src/backend/catalog/heap.c             | 48 +++++++++++++++++++++++++---------
src/backend/catalog/index.c            |  2 +-
src/backend/commands/tablecmds.c       |  4 +--
src/backend/parser/parse_relation.c    | 10 +++++--
src/include/catalog/heap.h             |  8 ++++--
src/test/regress/expected/rowtypes.out | 11 ++++++++
src/test/regress/sql/rowtypes.sql      |  6 +++++
7 files changed, 70 insertions(+), 19 deletions(-)