From: Mark Volpe <volpe.mark@epamail.epa.gov>
To: pgsql-sql@postgresql.org
Subject: PL/pgSQL evaluation order
Date: Thu, 03 Aug 2000 11:30:27 -0400
Message-ID: <39899013.AA9243EC@epamail.epa.gov> (raw)
Hi,
I have trigger function with the statement:
IF TG_OP=''INSERT'' OR NEW.ip!=OLD.ip THEN
expecting the TG_OP=''INSERT'' to be evaluated
first, and if true, proceed with the body.
But it gets evaluated as the result of an INSERT
statement, I get a (rather strangly worded) error:
ERROR: record old is unassigned yet
which means that the second statement is still being
evaluated even though the first is true. Assuming
that this is the result of the parser/planner messing
with that statement, is there a way to force evaluation
order without having to go:
IF TG_OP=''INSERT'' THEN
<body>
ELSE
IF NEW.OP!=OLD.ip THEN
<repeat body>
END IF;
END IF;
Thanks,
Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: volpe.mark@epamail.epa.gov
Subject: Re: PL/pgSQL evaluation order
In-Reply-To: <39899013.AA9243EC@epamail.epa.gov>
References: <39899013.AA9243EC@epamail.epa.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox