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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-05-28 19:24:32 Re: Null values in indexes
Previous Message Hannu Krosing 2002-05-28 19:10:15 Re: Null values in indexes