Search Postgresql Archives

"RETURNS SETOF" function question

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

 




Suppose that stored procedure foo has the signature:

  foo( text, text ) RETURNS SETOF text

Also, I have some table bar, and that column bar.baz is of type text.

Now, I'd like to run something like

  SELECT foo( "frobozz", baz ) FROM bar;

If I try this psql complains that I'm trying to execute a set-valued function in the wrong context.

But the intention of this invalid statement is to apply foo( "frobozz", ? ) once for each row of bar, replacing ? each time with the row's value of baz, and concatenate all the returned tables to produce the final result.  (In general, the number of rows resulting from this application has no relation to the number of rows in bar; i.e. it can be less than, equal to, or greater than this number.)

What must I do to get the desired behavior?

TIA!

kynn


[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