Re: Return a table from a function

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Return a table from a function
Дата
Msg-id 1f660bc35d01cd27112dde5b01ef9b32bab92c16.camel@cybertec.at
обсуждение исходный текст
Ответ на Return a table from a function  (Simon Connah <simon.n.connah@protonmail.com>)
Ответы Re: Return a table from a function
Список pgsql-novice
On Tue, 2021-04-06 at 16:52 +0000, Simon Connah wrote:
> I've written a function that returns a table. It works fine and I get the expected results.
>  The only problem is that in Node.js which is the client the table data is a string rather
>  than a list of variables. Is there some way to change the return data so it is still like
>  a table but in something like JSON? Or even better is there a way to return it as the
>  individual rows so that each column can be easily accessed? I'm using pg-promise to access
>  PostgreSQL from a Node.js web application.

It's a bit unclear what you are doing, but I guess you should run

  SELECT * FROM myfunction('arg');

rather than

  SELECT myfunction('arg');

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




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

Предыдущее
От: Simon Connah
Дата:
Сообщение: Return a table from a function
Следующее
От: Simon Connah
Дата:
Сообщение: Re: Return a table from a function