Re: Alias in WHERE clause

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Eric Jain <jain(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Alias in WHERE clause
Date: 2000-05-20 11:37:59
Message-ID: 200005201137.HAA15792@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I would like to be able to say:
>
> SELECT url,score_a(text, CAST('term' AS TEXT)) AS score FROM articles
> WHERE score > 0
> ORDER BY score DESC;
>
> This returns: ERROR: Attribute 'score' not found.

We just don't support aliases in WHERE, as you suggest. I see your
problem if score_a is complicated. The issue is that the target list is
not evaluated until _after_ the WHERE clause.

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-05-20 12:24:44 Re: Re: [HACKERS] Postgresql OO Patch
Previous Message Bruce Momjian 2000-05-20 11:35:38 Re: rules on INSERT can't UPDATE new instance?