Re: How does one return rows from plpgsql functions?
От | Holger Krug |
---|---|
Тема | Re: How does one return rows from plpgsql functions? |
Дата | |
Msg-id | 20020121191624.A5417@dev12.rationalizer.com обсуждение исходный текст |
Ответ на | Re: How does one return rows from plpgsql functions? (Ryan Kirkpatrick <pgsql@rkirkpat.net>) |
Ответы |
Re: How does one return rows from plpgsql functions?
Re: How does one return rows from plpgsql functions? |
Список | pgsql-general |
On Mon, Jan 21, 2002 at 08:02:46AM -0700, Ryan Kirkpatrick wrote: > So, how do I get back and access the entire row returned from a > function without calling it multiple times? Or is that even possible? > Thanks. As I known, their is no straight way to do it. But you can do the following: SELECT get_id(p), get_fielda(p) WHERE p = update_get(1); Here `update_get' allocates space in a memory context like `CurrentTransactionContext' or what ever is necessary in your case, puts the resulting typle into the allocated space and returns a pointer p to that tuple. `get_*' are accessor methods for such a pointer, accessing the allocated memory and retrieving the values needed. To be as type-safe as possible I would recommend to introduce a special type `PointerToMyTableRow'. The input and output functions of that type should simply throw an exception (i.e. call `elog(ERROR,...)'), to avoid that pointers can be externalized. This all obviously requires some C-coding. But it works and would solve your problem. -- Holger Krug hkrug@rationalizer.com
В списке pgsql-general по дате отправления: