[GSoC] Question about returning bytea array

Поиск
Список
Период
Сортировка
От Charles Cui
Тема [GSoC] Question about returning bytea array
Дата
Msg-id CA+SXE9um+OBHOkBj4i4gHub-W4tw0+02MO4B_6AcZ6gJ+NNH9g@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GSoC] Question about returning bytea array  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: [GSoC] Question about returning bytea array  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
Hi Aleksander,

   I have the requirements to return a bytea array for some functions in pg_thrift plugin. 
What I did was similar to the following,

bytea** ret = palloc(len * sizeof(bytea*));
for (int i = 0; i < len; i++) {
   // allocate space
   ret[i] = palloc(size);
   // fill in ret[i]
   ...
}
PG_RETURN_POINTER(ret);
I can verify each ret[i] is correct by logging, but server crash when 
executed PG_RETURN_POINTER(ret). 
So, I am wondering what's the reason of the crash? 
and what's the recommended way (best practice) to construct a return value to be bytea array?

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: GiST VACUUM
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [GSoC] Question about returning bytea array