Re: C-Function: Returning Rows
От | Tom Lane |
---|---|
Тема | Re: C-Function: Returning Rows |
Дата | |
Msg-id | 8313.1273502329@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | C-Function: Returning Rows (Carel Combrink <s25291930@tuks.co.za>) |
Ответы |
Re: C-Function: Returning Rows
|
Список | pgsql-novice |
Carel Combrink <s25291930@tuks.co.za> writes: > in my function I have the following: > TupleDesc tup_descriptor; > Datum dat_values[2]; > HeapTuple heap_tuple; > bool *pNulls; > get_call_result_type(fcinfo, NULL, &tup_descriptor); > BlessTupleDesc(tup_descriptor); > dat_values[0] = Int32GetDatum(50); > dat_values[1] = Int32GetDatum(20); > iTup_Length = tup_descriptor->natts; > pNulls = palloc(iTup_Length * sizeof(bool)); > heap_tuple = heap_form_tuple(tup_descriptor, dat_values, pNulls); > PG_RETURN_DATUM(HeapTupleGetDatum(heap_tuple)); > Am I doing something wrong in my function that would have this affect? Failing to initialize the values of pNulls[], no doubt. It would also be a good idea to check for a failure result from get_call_result_type. BTW, what's the rationale for using a fixed-length Datum array and a variable-length nulls array? Usually people handle both of those the same way. regards, tom lane
В списке pgsql-novice по дате отправления: