Just skipping over them is not enough and results in passing
unitialised values to the code that forms a heap tuple.

Noticed while investigating a bug report from Jean-Baptiste Quenot.
---
src/pl/plpython/plpython.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index da34a17..90d3c47 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -2670,7 +2670,11 @@ PLyMapping_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *mapping)
PLyObToDatum *att;

if (desc->attrs[i]->attisdropped)
+ {
+ values[i] = (Datum) NULL;
+ nulls[i] = true;
continue;
+ }

key = NameStr(desc->attrs[i]->attname);
value = NULL;
@@ -2756,7 +2760,11 @@ PLySequence_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *sequence)
PLyObToDatum *att;

if (desc->attrs[i]->attisdropped)
+ {
+ values[i] = (Datum) NULL;
+ nulls[i] = true;
continue;
+ }

value = NULL;
att = &info->out.r.atts[i];
@@ -2819,7 +2827,11 @@ PLyGenericObject_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *object)
PLyObToDatum *att;

if (desc->attrs[i]->attisdropped)
+ {
+ values[i] = (Datum) NULL;
+ nulls[i] = true;
continue;
+ }

key = NameStr(desc->attrs[i]->attname);
value = NULL;
--
1.7.5.4


--------------090801030809000302010005--

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedAug 17, '11 at 2:04p
activeAug 17, '11 at 2:04p
posts1
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Jan Urbański: 1 post

People

Translate

site design / logo © 2022 Grokbase