Thread: Rules and variables?

Rules and variables?

From
Christian Rishoej
Date:
Hi,

I need to hold an integer value and use it in some queries in a rule I
have. I tried to use a temporary table, but without luck (got an error
like    Relation "tmpfoo" does not exist   ).

My question is: How can I hold this value thoughout the rule? Can I use
variables of some sort?

Christian





Re: Rules and variables?

From
Josh Berkus
Date:
Christian,

> I need to hold an integer value and use it in some queries in a rule I
> have. I tried to use a temporary table, but without luck (got an error
> like    Relation "tmpfoo" does not exist   ).
>
> My question is: How can I hold this value thoughout the rule? Can I use
> variables of some sort?

Have the rule execute a PL/pgSQL function.  PL/pgSQL has full variable
support; see the documentation under "procedural functions".