From 6693c9a5ed3ac9c07160039742dde8aa67e96ecf Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 13 Sep 2011 11:36:49 -0400 Subject: [PATCH] deflist_to_tuplestore dumped core on an option with no value. Make it return NULL for the option_value, instead. Per report from Frank van Vugt. Back-patch to 8.4 where this code was added. --- src/backend/foreign/foreign.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c index 67a4597c38..a7d30a15ca 100644 --- a/src/backend/foreign/foreign.c +++ b/src/backend/foreign/foreign.c @@ -363,8 +363,17 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options) DefElem *def = lfirst(cell); values[0] = CStringGetTextDatum(def->defname); - values[1] = CStringGetTextDatum(((Value *) def->arg)->val.str); - nulls[0] = nulls[1] = false; + nulls[0] = false; + if (def->arg) + { + values[1] = CStringGetTextDatum(((Value *) (def->arg))->val.str); + nulls[1] = false; + } + else + { + values[1] = (Datum) 0; + nulls[1] = true; + } tuplestore_putvalues(tupstore, tupdesc, values, nulls); } -- 2.40.0