Re: Alias in WHERE clause

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Alias in WHERE clause
Дата
Msg-id 200005201137.HAA15792@candle.pha.pa.us
обсуждение исходный текст
Ответ на Alias in WHERE clause  ("Eric Jain" <jain@gmx.net>)
Список 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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: rules on INSERT can't UPDATE new instance?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Re: [HACKERS] Postgresql OO Patch