| От | Jasen Betts |
|---|---|
| Тема | Re: inconsistency in aliasing |
| Дата | |
| Msg-id | gkn2qk$16m$3@reversiblemaps.ath.cx обсуждение |
| Список | pgsql-hackers |
On 2009-01-14, Louis-David Mitterrand <vindex+lists-pgsql-general@apartia.org> wrote: > Hi, > > This works: > > critik=# select current_timestamp::abstime::int4 as score order by score; > > This doesn't: > > critik=# select current_timestamp::abstime::int4 as score order by score + 1; > ERROR: column "score" does not exist > LINE 1: ...urrent_timestamp::abstime::int4 as score order by score + 1 ... > > Any idea ? > > Thanks, if you really want to do that you can use a subselect, select score from ( select current_timestamp::abstime::int4 as score ) as foo order by score+1; but the demonstration is more interesting when the query returns several rows and the expression changes the order. select score from ( select generate_series(1,10) as score ) as foo order by score % 2 desc; -- odds and evens. :) bye.
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера