aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-11-09 12:28:34 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-11-09 12:28:34 -0500
commit4f981df8e0b7bc00d22ab0db65579589c9d4bb8c (patch)
tree4d0c099b33e7ffb2fc26d9c0a3d346c9c4eec337 /src/backend/access
parente613ace1f0d5734b62b133e9700300166ece1599 (diff)
downloadpostgresql-4f981df8e0b7bc00d22ab0db65579589c9d4bb8c.tar.gz
postgresql-4f981df8e0b7bc00d22ab0db65579589c9d4bb8c.zip
Report a more useful error for reloptions on a partitioned table.
Previously, trying to set storage parameters on a partitioned table always led to "unrecognized parameter foo", because the code expected there might be some valid parameters; but there aren't any. The docs make clear that it's intended that there never will be any, so let's replace this useless search with a more to-the-point message. Simon Riggs and Karina Litskevich Discussion: https://postgr.es/m/CANbhV-H=eZ9kTR9mUgKGK0Qv9uXP=U+dQg3rinQHfTdFMhBA2A@mail.gmail.com
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/common/reloptions.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 6458a9c2769..75b7344891a 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1984,13 +1984,12 @@ build_local_reloptions(local_relopts *relopts, Datum options, bool validate)
bytea *
partitioned_table_reloptions(Datum reloptions, bool validate)
{
- /*
- * There are no options for partitioned tables yet, but this is able to do
- * some validation.
- */
- return (bytea *) build_reloptions(reloptions, validate,
- RELOPT_KIND_PARTITIONED,
- 0, NULL, 0);
+ if (validate && reloptions)
+ ereport(ERROR,
+ errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot specify storage parameters for a partitioned table"),
+ errhint("Specify storage parameters for its leaf partitions, instead."));
+ return NULL;
}
/*