Re: Return dynamic columns of a temporary table

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Return dynamic columns of a temporary table
Дата
Msg-id CAFj8pRCUSC64b5FsrU3g5-fDBVA+qkFsy5dXJqL1wbX0wC=GPg@mail.gmail.com
обсуждение исходный текст
Ответ на Return dynamic columns of a temporary table  (clear chan <clear.cas.1140@gmail.com>)
Список pgsql-general
Hello

2012/10/4 clear chan <clear.cas.1140@gmail.com>:
> Hi, i am new to postresql and have been trying to convert some of our mssql
> procedures into postresql functions. What i have been trying to do is to
> somehow return a temporary table with dynamic columns. Is it possible?
>

it is possible, but usually it is not, what you want

CREATE OR REPLACE FUNCTION foo()
RETURNS SETOF RECORD AS $$
SELECT * FROM temptab;
$$ LANGUAGE sql;

but you have to specify columns in query

SELECT * FROM foo() (a int, b int, c int);

A style of PostgreSQL stored procedures is significantly different
than MSSQL - it is more close to Oracle.

Regards

Pavel Stehule

>


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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Moving from Java 1.5 to Java 1.6
Следующее
От: Shaun Thomas
Дата:
Сообщение: Re: Moving from Java 1.5 to Java 1.6