returning array in a field together with other types

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема returning array in a field together with other types
Дата
Msg-id 20100129010026.0d0a2841@dawn.webthatworks.it
обсуждение исходный текст
Список pgsql-hackers
I'm trying to return a set of record as:
(text, int[]),
(text, int[]),
...
row from C
and I really would like to avoid to use BuildTupleFromCString

So this is how I think my function should end...

char *curout; /* cstring */
int4 *pos;

...

get_typlenbyvalalign(INT4OID, &typlen, &typbyval, &typalign);
v_pos = construct_array( pos, npos, INT4OID, typlen, typbyval, typalign
);

values[0] = GET_TEXT(curout); /* correct? */
values[1] = PointerGetDatum(v_pos); /* ???? */

resultTuple = heap_form_tuple(inter_call_data->tupd, values, nulls);
result = HeapTupleGetDatum(resultTuple);

SRF_RETURN_NEXT(fctx, result);

...

I've seen that GET_TEXT(curout) just call textin.
I wonder if other GET_ macro aren't really converting to text
representation and then back to Datum... so there is no real
difference with using BuildTupleFromCString.

BTW could I pass static values to construct_array since they are
"basic type" array so the size etc... should be known at compile
time, inspite of having to call get_typlenbyvalalign?

thanks

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



В списке pgsql-hackers по дате отправления:

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: Largeobject Access Controls (r2460)
Следующее
От: KaiGai Kohei
Дата:
Сообщение: Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns