aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/partitionfuncs.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-03-01 09:07:07 +0900
committerMichael Paquier <michael@paquier.xyz>2019-03-01 09:07:07 +0900
commit0f3cdf873e7d81fbf61965e13685595c8a23c322 (patch)
tree105293a04b1dd840b69118c69ff216300c1f62f4 /src/backend/utils/adt/partitionfuncs.c
parent253655116bb437d649203a5a87105e885e4b08f9 (diff)
downloadpostgresql-0f3cdf873e7d81fbf61965e13685595c8a23c322.tar.gz
postgresql-0f3cdf873e7d81fbf61965e13685595c8a23c322.zip
Make pg_partition_tree return no rows on unsupported and undefined objects
The function was tweaked so as it returned one row full of NULLs when working on an unsupported relkind or an undefined object as of cc53123, and after discussion with Amit and Álvaro it looks more natural to make it return no rows. Author: Michael Paquier Reviewed-by: Álvaro Herrera, Amit Langote Discussion: https://postgr.es/m/20190227184808.GA17357@alvherre.pgsql
Diffstat (limited to 'src/backend/utils/adt/partitionfuncs.c')
-rw-r--r--src/backend/utils/adt/partitionfuncs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/partitionfuncs.c b/src/backend/utils/adt/partitionfuncs.c
index ffd66b64394..36d9f69cbcc 100644
--- a/src/backend/utils/adt/partitionfuncs.c
+++ b/src/backend/utils/adt/partitionfuncs.c
@@ -69,9 +69,6 @@ pg_partition_tree(PG_FUNCTION_ARGS)
FuncCallContext *funcctx;
ListCell **next;
- if (!check_rel_can_be_partition(rootrelid))
- PG_RETURN_NULL();
-
/* stuff done only on the first call of the function */
if (SRF_IS_FIRSTCALL())
{
@@ -82,6 +79,9 @@ pg_partition_tree(PG_FUNCTION_ARGS)
/* create a function context for cross-call persistence */
funcctx = SRF_FIRSTCALL_INIT();
+ if (!check_rel_can_be_partition(rootrelid))
+ SRF_RETURN_DONE(funcctx);
+
/* switch to memory context appropriate for multiple function calls */
oldcxt = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);