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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow partition key expressions that return pseudo-types.
Date: 2019-12-23 17:53:33
Message-ID: E1ijRtd-0004j7-4O@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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_10_STABLE

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

Modified Files
--------------
src/backend/commands/tablecmds.c | 10 ++++++++++
src/test/regress/expected/create_table.out | 13 ++++++++++++-
src/test/regress/sql/create_table.sql | 12 +++++++++++-
3 files changed, 33 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Joe Conway 2019-12-23 18:36:18 pgsql: Disallow null category in crosstab_hash
Previous Message Tom Lane 2019-12-23 17:08:56 pgsql: Prevent a rowtype from being included in itself via a range.