Martijn van Oosterhout escribió: > On Tue, Apr 22, 2008 at 02:41:50AM -0700, wstrzalka wrote: > > One of the annoying things in plpgsql is logical expression > > evaluation. > > > > In most (all??) languages I know, logical expression like: > > > > if ( [A_true_expression] or [B_false_expression] ) then > > > > will stop evaluating when the A expression will be evaluated as a > > TRUE. > > I guess you should complain to the SQL design comittee, SQL is a > declarative language not a procedural language and the order of the > expressions in AND/OR is not important to the evaluation. While I agree with that in principle, we should by now start getting used to the idea that PL/pgSQL is a different language from SQL. For example, SELECT INTO are totally different in both languages. So are BEGIN and END, and then there are loads of procedural constructs not found on SQL at all. I think this business of non-shortcircuiting boolean operators is just an artifact of the fact that PL/pgSQL hands off expression to the SQL engine for evaluation. Perhaps SQL/PSM is designed differently (I haven't checked), or PL/SQL words differently on Oracle. If either of these cases is true, we will need to attack the problem sooner or later. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.