pgsql: Disallow partition key expressions that return pseudo-types. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Disallow partition key expressions that return pseudo-types.
Date
Msg-id E1ijRtd-0004j2-3F@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Disallow partition key expressions that return pseudo-types.

This wasn't checked originally, but it should have been, because
in general pseudo-types can't be stored to and retrieved from disk.
Notably, partition bound values of type "record" would not be
interpretable by another session.

In v12 and HEAD, add another flag to CheckAttributeType's repertoire
so that it can produce a specific error message for this case.  That's
infeasible in older branches without an ABI break, so fall back to
a slightly-less-nicely-worded error message in v10 and v11.

Problem noted by Amit Langote, though this patch is not his initial
solution.  Back-patch to v10 where partitioning was introduced.

Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7fbb39a967ea7fa32915407ea87eee1d5f38d9e7

Modified Files
--------------
src/backend/catalog/heap.c                 | 43 +++++++++++++++++++++++-------
src/backend/commands/tablecmds.c           | 16 +++++++++--
src/include/catalog/heap.h                 |  1 +
src/test/regress/expected/create_table.out | 13 ++++++++-
src/test/regress/sql/create_table.sql      | 12 ++++++++-
5 files changed, 71 insertions(+), 14 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Prevent a rowtype from being included in itself via a range.
Next
From: Joe Conway
Date:
Subject: pgsql: Disallow null category in crosstab_hash