Обсуждение: SetOf Functions
Hello, O.k. I know I can do: CREATE FUNCTION foo() RETURNS SET OF text AS ' ' language SQL; Does anyone else think it would be nice to be able to do: CREATE FUNCTION foo() RETURNS SET OF text,int4,float,timestamp AS ' ' language SQL; ? We could even extend it farther: CREATE FUNCTION foo() RETURNS SET OF text AS first_name, int4 AS id etc.... Sincerely, Joshua D. Drake -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
Josh, > CREATE FUNCTION foo() RETURNS SET OF text,int4,float,timestamp AS ' ' > language SQL; You can effectively do this with the new INOUT syntax. Check it out in the 8.1devel docs. -- Josh Berkus Aglio Database Solutions San Francisco
>> > > You mean like this? > > create type bar (firstname text, id int); > create function foo() returns setof bar as ' ' language sql; No. I am aware I can do that ;) I don't want to have to create the type ahead of time :) Sincerely, Joshua D. Drake > > cheers > > andrew -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
Josh Berkus wrote: > Josh, > > >>CREATE FUNCTION foo() RETURNS SET OF text,int4,float,timestamp AS ' ' >>language SQL; > > > You can effectively do this with the new INOUT syntax. Check it out in the > 8.1devel docs. Cool thanks... (takes note to document in the book) > -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/
Joshua D. Drake wrote: > Hello, > > O.k. I know I can do: > > CREATE FUNCTION foo() RETURNS SET OF text AS ' ' language SQL; > > Does anyone else think it would be nice to be able to do: > > CREATE FUNCTION foo() RETURNS SET OF text,int4,float,timestamp AS ' ' > language SQL; > > ? > > We could even extend it farther: > > CREATE FUNCTION foo() RETURNS SET OF text AS first_name, int4 AS id > etc.... > > You mean like this? create type bar (firstname text, id int); create function foo() returns setof bar as ' ' language sql; cheers andrew