Skip site navigation (1) Skip section navigation (2)

Re: wierd AND condition evaluation for plpgsql

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Louis-David Mitterrand <vindex(at)apartia(dot)org>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: wierd AND condition evaluation for plpgsql
Date: 2002-05-28 19:16:07
Message-ID: 1022613367.1902.9.camel@rh72.home.ee (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, 2002-05-28 at 21:52, Peter Eisentraut wrote:
> Louis-David Mitterrand writes:
> 
> > Shouldn't plpgsql shortcut AND conditions when a previous one fails, as
> > perl does?
> 
> Shouldn't perl evaluate all operands unconditionally, like plpgsql does?
> 
> Seriously, if you want to change this you have to complain to the SQL
> standards committee.

Is plpgsl a SQL standards committee standard ?


and is the following non-standard ?

(itest is a 16k row test table with i in 1-16k)

hannu=# create sequence itest_seq;
CREATE
hannu=# select nextval('itest_seq');
 nextval 
---------
       1
(1 row)

hannu=# select count(*) from itest where false and true;
 count 
-------
     0
(1 row)

hannu=# select count(*) from itest where false and i =
nextval('itest_seq');
 count 
-------
     0
(1 row)

hannu=# select nextval('itest_seq');
 nextval 
---------
       2
(1 row)

hannu=# select count(*) from itest where i = nextval('itest_seq');
 count 
-------
     0
(1 row)

hannu=# select nextval('itest_seq');
 nextval 
---------
   16387
(1 row)

---------------------
Hannu



In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-05-28 19:24:32
Subject: Re: Null values in indexes
Previous:From: Hannu KrosingDate: 2002-05-28 19:10:15
Subject: Re: Null values in indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group