|
|
|
|
|
|
| Author |
Message |
Tom Lane *nix forums Guru
Joined: 24 Mar 2005
Posts: 2070
|
Posted: Wed Jul 19, 2006 3:29 am Post subject:
Re: shortcircuit logic in plpsql
|
|
|
Joseph Shraibman <jks@selectacast.net> writes:
| Quote: | Does plpgsql not short circuit its logic?
|
We make no guarantees about evaluation order. In the particular
case at hand, you're losing because plpgsql has to evaluate all
the variables that it's going to pass into the SQL engine for
that expression. Break it into two statements ...
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings |
|
| Back to top |
|
 |
Joseph Shraibman *nix forums beginner
Joined: 31 Mar 2005
Posts: 42
|
Posted: Wed Jul 19, 2006 3:12 am Post subject:
shortcircuit logic in plpsql
|
|
|
I'm trying to do this:
IF TG_OP = \'INSERT\' OR (TG_OP = \'UPDATE\' AND OLD.status <>
NEW.status) THEN
...but pg is complaining:
ERROR: record "old" is not assigned yet
DETAIL: The tuple structure of a not-yet-assigned record is indeterminate.
CONTEXT: PL/pgSQL function "set_dir_count" line 4 at if
Does plpgsql not short circuit its logic?
=>select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.8 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2
20030222 (Red Hat Linux 3.2.2-5)
(1 row)
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Nov 21, 2008 4:23 pm | All times are GMT
|
|
Nationwide Building Society | Mobile Phones | Online Dating | Mobile Phones | Internet Advertising
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|