Thread: PL/PgSQL Question

PL/PgSQL Question

From
Brian Knox
Date:
From within a postgresql rule, is it possible to get at the values
specified in the WHERE clause of the query?

For example, given the query:

DELETE FROM map_tr_relationship WHERE fk_tr1_id = 4 AND fk_tr2_id = 5 AND
fk_tr_relationship_type_id = 1 AND from_tr_request_id = 4;

I want to intercept that query with a rule, and with DO INSTEAD call a
stored procedure and pass the values in the where clause to that stored
proc? Is this possible? If so, how?

Thanks for any info.

Brian Knox
laotse@aol.net



Re: PL/PgSQL Question

From
"A.Bhuvaneswaran"
Date:
> I want to intercept that query with a rule, and with DO INSTEAD call a
> stored procedure and pass the values in the where clause to that stored
> proc? Is this possible? If so, how?

If this is the case, why don't you try a triggered procedure? Follow the 
below link to learn howto write triggered procedures:

http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=plpgsql-trigger.html

regards,
bhuvaneswaran