Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07daca5

Browse files
committed
Fix inconsistencies in SRF checks of pg_config() and string_to_table()
The execution paths of those functions have been using a set of checksinconsistent with any other SRF function:- string_to_table() missed a check on expectedDesc, the tuple descriptorexpected by the caller, that should never be NULL. Introduced in66f1630.- pg_config() should check for a ReturnSetInfo, and expectedDesc cannotbe NULL. Its error messages were also inconsistent. Introduced ina5c43b8.Extracted from a larger patch by the same author, in preparation for alarger patch set aimed at refactoring the way tuplestores are createdand checked in SRF functions.Author: Melanie PlagemanReviewed-by: Justin PryzbyDiscussion:https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com
1 parent618c167 commit07daca5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

‎src/backend/utils/adt/varlena.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4839,7 +4839,8 @@ text_to_table(PG_FUNCTION_ARGS)
48394839
ereport(ERROR,
48404840
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
48414841
errmsg("set-valued function called in context that cannot accept a set")));
4842-
if (!(rsi->allowedModes&SFRM_Materialize))
4842+
if (!(rsi->allowedModes&SFRM_Materialize)||
4843+
rsi->expectedDesc==NULL)
48434844
ereport(ERROR,
48444845
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
48454846
errmsg("materialize mode required, but it is not allowed in this context")));

‎src/backend/utils/misc/pg_config.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ pg_config(PG_FUNCTION_ARGS)
3737
inti=0;
3838

3939
/* check to see if caller supports us returning a tuplestore */
40-
if (!rsinfo|| !(rsinfo->allowedModes&SFRM_Materialize))
40+
if (rsinfo==NULL|| !IsA(rsinfo,ReturnSetInfo))
4141
ereport(ERROR,
42-
(errcode(ERRCODE_SYNTAX_ERROR),
43-
errmsg("materialize mode required, but it is not "
44-
"allowed in this context")));
42+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
43+
errmsg("set-valued function called in context that cannot accept a set")));
44+
if (!(rsinfo->allowedModes&SFRM_Materialize)||
45+
rsinfo->expectedDesc==NULL)
46+
ereport(ERROR,
47+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
48+
errmsg("materialize mode required, but it is not allowed in this context")));
4549

4650
per_query_ctx=rsinfo->econtext->ecxt_per_query_memory;
4751
oldcontext=MemoryContextSwitchTo(per_query_ctx);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp