"ERROR: Argument of WHERE must not be a set function"? - Mailing list pgsql-general

From Drew Wilson
Subject "ERROR: Argument of WHERE must not be a set function"?
Date
Msg-id 7EC23222-7065-11D7-AB01-00039342B2CE@speakeasy.net
Whole thread Raw
In response to Passing nulls into PL/pgSQL functions  (Adam Witney <awitney@sghms.ac.uk>)
Responses Re: "ERROR: Argument of WHERE must not be a set function"?  (Dennis Gearon <gearond@cvc.net>)
Re: "ERROR: Argument of WHERE must not be a set function"?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
I want to use a function to generate a list of OIDs to be used in a
subselect.

However, I can't figure out what to return from my function that will
properly work in a WHERE clause.

I tried:
CREATE FUNCTION myTest() RETURNS SETOF oid AS 'SELECT id FROM foo;'
LANGUAGE SQL;

But when I try:
SELECT * FROM foo WHERE id in in (myTest());

I get this error message:
"ERROR: Argument of WHERE must not be a set function"


How can I use a function to generate my subselect? (I want to cal my
function just once, and avoid calling it once per row.)

Thanks,

Drew


pgsql-general by date:

Previous
From: "dewins murillo"
Date:
Subject: New Control Panel for Postgresql 7.1.3
Next
From: Dennis Gearon
Date:
Subject: Re: "ERROR: Argument of WHERE must not be a set function"?