Define a function that accepts query result as a parameter - Mailing list pgsql-novice

From Cheng
Subject Define a function that accepts query result as a parameter
Date
Msg-id 4F6CA426.30205@gmail.com
Whole thread Raw
Responses Re: Define a function that accepts query result as a parameter  (Rob Richardson <RDRichardson@rad-con.com>)
List pgsql-novice
Hi all,

I have two tables A and B, I defined a function f() on A. The problem is
to process the rows in A whose id has appeared in Table B. To save
time,  I want to to run function f() on only records that appeared in B.
I tried this:

define f(integer[]) as
$$
process records where id in $1
$$ language sql

then I tried to call the function using f(select array_agg(id) from B).
It does not work.
Do you guys know how I can achieve this?

Thanks,
Cheng

pgsql-novice by date:

Previous
From: sreeaurovindh viswanathan
Date:
Subject: how to leverage index for order by
Next
From: Rob Richardson
Date:
Subject: Re: Define a function that accepts query result as a parameter