Re: Failure assertion in GROUPS mode of window function in current HEAD

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Failure assertion in GROUPS mode of window function in current HEAD
Дата
Msg-id 13102.1531175068@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Failure assertion in GROUPS mode of window function in current HEAD  (Masahiko Sawada <sawada.mshk@gmail.com>)
Ответы Re: Failure assertion in GROUPS mode of window function in current HEAD  (Masahiko Sawada <sawada.mshk@gmail.com>)
Список pgsql-hackers
Masahiko Sawada <sawada.mshk@gmail.com> writes:
> I got an assertion failure when I use GROUPS mode and specifies offset
> without ORDER BY clause. The reproduction steps and the backtrace I
> got are following.

> =# create table test as select 1 as c;
> =# select sum(c) over (partition by c groups between 1 preceding and
> current row) from test;
> TRAP: FailedAssertion("!(ptr >= 0 && ptr < state->readptrcount)",
> File: "tuplestore.c", Line: 478)

Hm.  Shouldn't we reject this case?  I don't see how GROUPS mode makes
any sense with no ORDER BY.  Maybe you could define it as working with
"groups" of one row each, but the standard seems to think not:

   c) If GROUPS is specified, then:

      i) Either WDEF shall contain a <window order clause>, or WDEF shall
      specify an <existing window name> that identifies a window structure
      descriptor that includes a window ordering clause.

The fact that you got an assertion failure is not very nice, maybe we
need some more code defenses there; but probably the whole thing
should be rejected at parse time.

            regards, tom lane


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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: Locking B-tree leafs immediately in exclusive mode
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Locking B-tree leafs immediately in exclusive mode