Alias in WHERE clause

Поиск
Список
Период
Сортировка
От Eric Jain
Тема Alias in WHERE clause
Дата
Msg-id NCBBJFHBEGOIAHBCBNCLAEPJCEAA.jain@gmx.net
обсуждение исходный текст
Ответы Re: Alias in WHERE clause
Re: Alias in WHERE clause
Список pgsql-general
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.

The following works:

SELECT url,score_a(text, CAST('term' AS TEXT)) AS score FROM articles
WHERE score_a(text, CAST('term' AS TEXT)) > 0
ORDER BY score DESC;

Doesn't seem efficient to me? Or are the results from score_a cached
somehow?

score_a is a (rather computation-intensive :-) PL/Perl function which
returns an integer.

I am using PostgreSQL 7.0


--
Eric Jain


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