aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-06-12 13:44:06 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-06-12 13:44:06 -0400
commitae58f1430abb4b0c309c40b377f91bf9d080334b (patch)
treefb6f6ee8343d48f78456be243c88e7ee9d987638 /src/backend/utils/adt/jsonfuncs.c
parentb00982344a73d9cb626430dd17a6da84c15c9980 (diff)
downloadpostgresql-ae58f1430abb4b0c309c40b377f91bf9d080334b.tar.gz
postgresql-ae58f1430abb4b0c309c40b377f91bf9d080334b.zip
Fix failure to cover scalar-vs-rowtype cases in exec_stmt_return().
In commit 9e3ad1aac52454569393a947c06be0d301749362 I modified plpgsql to use exec_stmt_return's simple-variables fast path in more cases. However, I overlooked that there are really two different return conventions in use here, depending on whether estate->retistuple is true, and the existing fast-path code had only bothered to handle one of them. So trying to return a scalar in a function returning composite, or vice versa, could lead to unexpected error messages (typically "cache lookup failed for type 0") or to a null-pointer-dereference crash. In the DTYPE_VAR case, we can just throw error if retistuple is true, corresponding to what happens in the general-expression code path that was being used previously. (Perhaps someday both of these code paths should attempt a coercion, but today is not that day.) In the REC and ROW cases, just hand the problem to exec_eval_datum() when not retistuple. Also clean up the ROW coding slightly so it looks more like exec_eval_datum(). The previous commit also caused exec_stmt_return_next() to be used in more cases, but that code seems to be OK as-is. Per off-list report from Serge Rielau. This bug is new in 9.5 so no need to back-patch.
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
0 files changed, 0 insertions, 0 deletions