order of clauses

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: order of clauses
Date: 2001-02-14 22:19:14
Message-ID: 20010214221914.G17556@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

create table vals (
x float,
y float
);
insert into vals values (2,4);
insert into vals values (2,2);
insert into vals values (2,1);
insert into vals values (2,0);
select x/y from vals where y>0 and x/y>1;

will give a divide by zero error as A=(y>0) and B=(x/y>1) can be evaluated in
any order (A and B = B and A). I obviously would like (y>0) to happen first,
but I don't see how this can be achieved.. Any ideas?

Cheers,

Patrick

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan McGrath 2001-02-14 23:16:13 Re: Row ID and auto-increment?
Previous Message Jan Wieck 2001-02-14 21:39:44 Re: transaction safety