[HACKERS] How to write a c-function to return multiple bytea rows

2007-11-28 Thread Billow Gao
I can return multiple strings w/o problem. But if I tried to return multiple bytea rows. It only return 10 rows with empty data. Please see the code below. Also, when I compile it, I had warning: test.c:121: warning: assignment makes pointer from integer without a cast The line is: tuple =

Re: [HACKERS] How to write a c-function to return multiple bytea rows

2007-11-28 Thread Gregory Stark
I don't know if it's the proximate source of your problem but your MemoryContextSwitchTo() calls are mixed up. You're reusing the same oldcontext variable for both the switch you're doing in the main body and the switch you're doing in the inner loop. At the very least you should use two

Re: [HACKERS] How to write a c-function to return multiple bytea rows

2007-11-28 Thread Tom Lane
Billow Gao [EMAIL PROTECTED] writes: Also, when I compile it, I had warning: test.c:121: warning: assignment makes pointer from integer without a cast The line is: tuple = heap_form_tuple( tupdesc, dtvalues, isNull ); That part is because you didn't #include access/heapam.h, where