Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id B2666475B4B for ; Fri, 17 May 2002 19:53:48 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 55964475D97 for ; Fri, 17 May 2002 19:51:52 -0400 (EDT) Received: from [209.122.114.82] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1463327; Fri, 17 May 2002 16:51:52 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Christian Rishoej , pgsql-sql@postgresql.org Subject: Re: Rules and variables? Date: Fri, 17 May 2002 16:53:33 -0700 X-Mailer: KMail [version 1.4] References: <1021678745.15813.42.camel@penelope.dyndns.dk> In-Reply-To: <1021678745.15813.42.camel@penelope.dyndns.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200205171653.33416.josh@agliodbs.com> X-Archive-Number: 200205/189 X-Sequence-Number: 7824 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 ). >=20 > 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=20 support; see the documentation under "procedural functions".