From: Ivan Sergio Borgonovo on 28 Jan 2010 19:00 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
Pages: 1 Prev: remove contrib/xml2 Next: Add on_perl_init and proper destruction to plperl UPDATED[PATCH] |