8000 deflist_to_tuplestore dumped core on an option with no value. · fschopp/postgres@5d68fe1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d68fe1

Browse files
committed
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.
1 parent c10d1de commit 5d68fe1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/backend/foreign/foreign.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
270270
TupleDesc tupdesc;
271271
Tuplestorestate *tupstore;
272272
Datum values[2];
273-
bool nulls[2] = {0};
273+
bool nulls[2];
274274
MemoryContext per_query_ctx;
275275
MemoryContext oldcontext;
276276

@@ -302,7 +302,17 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
302302
DefElem *def = lfirst(cell);
303303

304304
values[0] = CStringGetTextDatum(def->defname);
305-
values[1] = CStringGetTextDatum(((Value *) def->arg)->val.str);
305+
nulls[0] = false;
306+
if (def->arg)
307+
{
308+
values[1] = CStringGetTextDatum(((Value *) (def->arg))->val.str);
309+
nulls[1] = false;
310+
}
311+
else
312+
{
313+
values[1] = (Datum) 0;
314+
nulls[1] = true;
315+
}
306316
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
307317
}
308318

0 commit comments

Comments
 (0)
0