On Jun 1, 2007, at 13:31 , Brian Hurt wrote:
>
> I want to write a query like:
>
> INSERT INTO table SELECT func(args);
I think you might want to try something along the lines of
INSERT INTO table (col1, col2, col3)
SELECT col1, col2, col3
FROM func(args);
Then again, you could wrap the whole insert into the function:
CREATE FUNCTION func(args)
RETURNS VOID
LANGUAGE plpgsql AS $_$
-- ...
INSERT INTO table (col1, col2, col3)...
$_$;
then SELECT func(args); to call the function.
Michael Glaesemann
grzm seespotcode net