Re: referencing to "computed columns" in where clause

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: referencing to "computed columns" in where clause
Date: 2008-01-29 17:17:39
Message-ID: 20080129171739.GV18990@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 29, 2008 at 06:04:48PM +0100, Ivan Sergio Borgonovo wrote:
> select
> case
> when (a>3) then a*b
> when (a<3) then a+b
> end as pippo
> where pippo<12;

I've tended to do:

SELECT *
FROM (
SELECT "complicated expression" AS pippo) x
WHERE pippo < 12;

Sam

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-01-29 17:49:50 Re: referencing to "computed columns" in where clause
Previous Message Ivan Sergio Borgonovo 2008-01-29 17:04:48 referencing to "computed columns" in where clause