Re: Rules and variables? - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Rules and variables?
Date
Msg-id 200205171653.33416.josh@agliodbs.com
Whole thread Raw
In response to Rules and variables?  (Christian Rishoej <chrris@mail.dk>)
List pgsql-sql
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".



pgsql-sql by date:

Previous
From: Christian Rishoej
Date:
Subject: Rules and variables?
Next
From: Josh Berkus
Date:
Subject: PL/pgSQL TODO