[GENERAL] Custom Base Type in C

2008-05-07 Thread Toby Chavez
I have been trying to created a custom base type in C to use as a state transition variable for some aggregate functions. By following the documentation I haven't been able to do much but crash postgres :) I can compile and run the complex example from the tutorial just fine so I guess that means I

Re: [GENERAL] Custom Base Type in C

2008-05-07 Thread Toby Chavez
I need to do the aggregate functions in c not pg/plsql so transition type needs to be accessible in c. If there is a way to do that without explicitly defining the type in c then that would be perfect. > > Is there any particular reason why this needs to be done in C? Why not > just create the typ

Re: [GENERAL] Custom Base Type in C

2008-05-07 Thread Toby Chavez
If I make it pass-by-reference and varlena do I have to worry about TOASTing and deTOASTing everying in my INPUT and OUTPUT functions? On Wed, May 7, 2008 at 5:15 PM, Alvaro Herrera <[EMAIL PROTECTED]> wrote: > Toby Chavez escribió: > > > My custom type needs to have one bigin

Re: [GENERAL] Using a composite SQL type in C

2008-05-08 Thread Toby Chavez
Check the documentation about using composite-type arguments in C http://www.postgresql.org/docs/8.2/static/xfunc-c.html#AEN37402 You can use GetAttributeByNum() or GetAttributeByName() to get each value from your custom type. You will need to get the HeapTupleHeader first by calling PG_GETARG_HEA