Re: BUG #5018: Window function alias

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #5018: Window function alias
Дата
Msg-id 4A9687F0.2060501@enterprisedb.com
обсуждение исходный текст
Ответ на BUG #5018: Window function alias  ("Marko Tiikkaja" <marko.tiikkaja@cs.helsinki.fi>)
Ответы Re: BUG #5018: Window function alias  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Marko Tiikkaja wrote:
> I came across this:
>
> => SELECT lead(foo) OVER(ORDER BY foo) AS foo FROM (VALUES(0)) bar(foo);
> ERROR:  window functions not allowed in window definition
>
> Changing the *column alias* to something else gives the expected answer. Is
> this really the desired behaviour?

It makes sense if you refer another column:

SELECT foo*2 AS col1, lead(foo) OVER(ORDER BY col1) AS foo
FROM (VALUES(0), (1)) bar(foo);

I'm not sure what the SQL spec says about that, but it seems OK to me.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Ashesh Vashi
Дата:
Сообщение: Re: BUG #5015: MySQL migration wizard does not start
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5018: Window function alias