Skip to content

Commit 7f1bcfb

Browse files
committed
Sync pltcl_build_tuple_result's error handling with pltcl_trigger_handler.
Meant to do this in 26abb50, but forgot.
1 parent 26abb50 commit 7f1bcfb

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/pl/tcl/pltcl.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3057,11 +3057,29 @@ pltcl_build_tuple_result(Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc,
30573057
char *fieldName = utf_e2u(Tcl_GetString(kvObjv[i]));
30583058
int attn = SPI_fnumber(call_state->ret_tupdesc, fieldName);
30593059

3060-
if (attn <= 0 || call_state->ret_tupdesc->attrs[attn - 1]->attisdropped)
3060+
/*
3061+
* As in pltcl_trigger_handler, silently ignore ".tupno" if it's in
3062+
* the list but doesn't match any column name.
3063+
*/
3064+
if (attn == SPI_ERROR_NOATTRIBUTE)
3065+
{
3066+
if (strcmp(fieldName, ".tupno") == 0)
3067+
continue;
30613068
ereport(ERROR,
30623069
(errcode(ERRCODE_UNDEFINED_COLUMN),
30633070
errmsg("column name/value list contains nonexistent column name \"%s\"",
30643071
fieldName)));
3072+
}
3073+
3074+
if (attn <= 0)
3075+
ereport(ERROR,
3076+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3077+
errmsg("cannot set system attribute \"%s\"",
3078+
fieldName)));
3079+
3080+
/* Ignore dropped attributes */
3081+
if (call_state->ret_tupdesc->attrs[attn - 1]->attisdropped)
3082+
continue;
30653083

30663084
values[attn - 1] = utf_e2u(Tcl_GetString(kvObjv[i + 1]));
30673085
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy