niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » PostgreSQL
shortcircuit logic in plpsql
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Tom Lane
*nix forums Guru


Joined: 24 Mar 2005
Posts: 2070

PostPosted: Wed Jul 19, 2006 3:29 am    Post subject: Re: shortcircuit logic in plpsql Reply with quote

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

PostPosted: Wed Jul 19, 2006 3:12 am    Post subject: shortcircuit logic in plpsql Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 4:23 pm | All times are GMT
navigation Forum index » Databases » PostgreSQL
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Parsing data file, need help with the logic guser@packetstorm.org Perl 9 Tue Jun 27, 2006 12:56 pm
No new posts need help with prog. logic Jim M Perl 9 Sun May 28, 2006 3:08 pm
No new posts DCL: IF and .AND. logic JF Mezei VMS 21 Sat May 27, 2006 9:12 am
No new posts I need a mini "logic interpreter" Papa Legba PHP 18 Fri May 19, 2006 9:34 am
No new posts problems with retry logic Pavel Gulchouck Exim 5 Thu May 04, 2006 10:32 pm

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
[ Time: 0.3518s ][ Queries: 20 (0.2468s) ][ GZIP on - Debug on ]