Search Postgresql Archives

Re: Return dynamic columns of a temporary table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

2012/10/4 clear chan <clear.cas.1140@xxxxxxxxx>:
> 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

>


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux