Re: stored procedure: RETURNS record

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: stored procedure: RETURNS record
Дата
Msg-id 199365E4-EDC9-4176-BACB-DDC6EF782DDD@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на stored procedure: RETURNS record  (InterRob <rob.marjot@gmail.com>)
Ответы Re: stored procedure: RETURNS record  (Rob Marjot <rob@marjot-multisoft.com>)
Список pgsql-general
On 25 Sep 2009, at 18:34, InterRob wrote:

> Unfortunately, this results in ONE row, with ONE column. E.g.:
>
> MYDB=# select * from (SELECT deserialize(kvp) FROM kvp) ss;
>  deserialize
> -----------
>  (1,2)
> (1 row)
>
> I guess I am seeking to prototype the anonymous row layout in the
> above SQL statement?


I'm not entirely sure about the syntax in your case, but I think
you're looking for:

MYDB=# select * from (SELECT deserialize(kvp) FROM kvp) ss (a int, b
int);

If that doesn't work, it's based on how you normally select from a
record-returning function, namely:
MYDB=# SELECT * FROM deserialize('some string') AS ss (a int, b int);

You may need to call it like this though:
MYDB=# select * from (SELECT (deserialize(kvp)).a, (deserialize
(kvp)).b FROM kvp) ss (a int, b int);

In that case your function better not be volatile or it will be
evaluated twice.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4abd04ce11682030514312!



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

Предыдущее
От: Sam Mason
Дата:
Сообщение: Re: [HACKERS] libpq port number handling
Следующее
От: Ron Mayer
Дата:
Сообщение: Re: generic modelling of data models; enforcing constraints dynamically...