referencing to "computed columns" in where clause - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject referencing to "computed columns" in where clause
Date
Msg-id 20080129180448.376b5475@webthatworks.it
Whole thread Raw
Responses Re: referencing to "computed columns" in where clause  (Sam Mason <sam@samason.me.uk>)
Re: referencing to "computed columns" in where clause  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-general
Is there a way to do things like

select (a-b) as pippo from ... where pippo=7;
or
select
  case
    when (a>3) then a*b
    when (a<3) then a+b
  end as pippo
where pippo<12;

other than defining a function such that I can write:

select func(a,b,c) as pippo from ... where func(a,b,c)=7;
?

Is there anything else I can do to avoid duplication of code?


--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: "Richard M. Kues"
Date:
Subject: Re: Surprising (?) Sequence Behavior
Next
From: Sam Mason
Date:
Subject: Re: referencing to "computed columns" in where clause