Re: [HACKERS] forming tuple as an attribute inside another tuple in c function

2010-09-27 Thread Marios Vodas
OK but what is the recommended way to get TupleDesc for p_type? I am aware of RelationNameGetTupleDesc but I shouldn't use it since it is deprecated. However by using it the code would look something like this (I tested it and it works as expected): Datum demo(PG_FUNCTION_ARGS) { float8 xi =

Re: [HACKERS] forming tuple as an attribute inside another tuple in c function

2010-09-27 Thread Robert Haas
On Mon, Sep 27, 2010 at 2:52 AM, Marios Vodas mvo...@gmail.com wrote: OK but what is the recommended way to get TupleDesc for p_type? It's mentioned in the documentation... http://www.postgresql.org/docs/current/static/xfunc-c.html#AEN47214 -- Robert Haas EnterpriseDB:

[HACKERS] forming tuple as an attribute inside another tuple in c function

2010-09-26 Thread Marios Vodas
Is it posible? Either by using heap_form_tuple or BuildTupleFromCStrings. CREATE TYPE p_type AS ( x double precision, y double precision ); CREATE TYPE d_type AS ( i p_type, e p_type, id integer ); CREATE OR REPLACE FUNCTION demo() RETURNS d_type AS

Re: [HACKERS] forming tuple as an attribute inside another tuple in c function

2010-09-26 Thread Tom Lane
Marios Vodas mvo...@gmail.com writes: Is it posible? Either by using heap_form_tuple or BuildTupleFromCStrings. heap_form_tuple followed by HeapTupleGetDatum should work; that's what's done in ExecEvalRow() for instance. You've omitted to tell us just what's going wrong for you.