Re: inconsistency in aliasing
| От | 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 по дате отправления: