git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 26abb50)
Sync pltcl_build_tuple_result's error handling with pltcl_trigger_handler.
Mon, 7 Nov 2016 00:22:12 +0000 (19:22 -0500)
Mon, 7 Nov 2016 00:22:12 +0000 (19:22 -0500)
Meant to do this in 26abb50c4, but forgot.


diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 3d529c2e7df90da3f1cad20807fb86d72f40ec9b..3e52113ee253762fdabae5e4cec3ac8b9557a712 100644 (file)
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -3057,11 +3057,29 @@ pltcl_build_tuple_result(Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc,
char *fieldName = utf_e2u(Tcl_GetString(kvObjv[i]));
int attn = SPI_fnumber(call_state->ret_tupdesc, fieldName);
- if (attn <= 0 || call_state->ret_tupdesc->attrs[attn - 1]->attisdropped)
+ /*
+ * As in pltcl_trigger_handler, silently ignore ".tupno" if it's in
+ * the list but doesn't match any column name.
+ */
+ if (attn == SPI_ERROR_NOATTRIBUTE)
+ {
+ if (strcmp(fieldName, ".tupno") == 0)
+ continue;
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column name/value list contains nonexistent column name \"%s\"",
fieldName)));
+ }
+
+ if (attn <= 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot set system attribute \"%s\"",
+ fieldName)));
+
+ /* Ignore dropped attributes */
+ if (call_state->ret_tupdesc->attrs[attn - 1]->attisdropped)
+ continue;
values[attn - 1] = utf_e2u(Tcl_GetString(kvObjv[i + 1]));
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /