2010/4/15 Tom Lane <t...@sss.pgh.pa.us>: > Pavel Stehule <pavel.steh...@gmail.com> writes: >> I think, so RETURNS TABLE can be modified for returning typmode >> without significant problems - this function is called in table >> context and I don't see any problematic use case. > > RETURNS TABLE is just a shorthand for some OUT parameters. I don't > believe it's either easy or a good idea to make it work differently > from every other function-argument-or-result case. >
I don't know now. It minimally have to be documented foodmart=# create function f() returns table (a varchar(10), b varchar(20)) as $$values('Pavel','Stehule')$$ language sql; CREATE FUNCTION Time: 121,506 ms foodmart=# select * from f(); a | b -------+--------- Pavel | Stehule (1 row) Time: 0,718 ms foodmart=# create table x as select * from f(); SELECT Time: 105,357 ms foodmart=# \d x Table "public.x" Column | Type | Modifiers --------+-------------------+----------- a | character varying | b | character varying | workaround is relative simple foodmart=# create function f() returns table (a varchar(10), b varchar(20)) as $$values('Pavel','Stehule')$$ language sql; CREATE FUNCTION Time: 1,009 ms foodmart=# create table x as select a::varchar(20), b::varchar(20) from (select * from f()) x ; SELECT Time: 48,592 ms foodmart=# \d x Table "public.x" Column | Type | Modifiers --------+-----------------------+----------- a | character varying(20) | b | character varying(20) | Regards Pavel Stehule > regards, tom lane > -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs