pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15262: "unexpected end of tuplestore" error when using new GROUPS window function clause
3+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2018-07-11 ff4f889164 8893d48e7f  Fix bugs with degenerate window ORDER BY clauses in GROUPS/RANGE mode.
* BUG #15262: "unexpected end of tuplestore" error when using new GROUPS window function clause
@ 2018-07-06 09:04  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2018-07-06 09:04 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: lukas.eder@gmail.com

The following bug has been logged on the website:

Bug reference:      15262
Logged by:          Lukas Eder
Email address:      lukas.eder@gmail.com
PostgreSQL version: 11beta2
Operating system:   Debian 6.3.0-18+deb9u1
Description:        

This error can be reproduced easily as follows

  postgres=# SELECT count(*) OVER (GROUPS 1 PRECEDING) FROM (VALUES (1),
(2), (2)) t(v);
  ERROR:  unexpected end of tuplestore

Notice the missing ORDER BY clause in the window specification. This works
as expected:

  postgres=# SELECT count(*) OVER (ORDER BY v GROUPS 1 PRECEDING) FROM
(VALUES (1), (2), (2)) t(v);
   count
  -------
       1
       3
       3
  (3 rows)

I used the latest 11 beta 2 version on Docker:

  postgres=# select version();
                                                                   version
 
-----------------------------------------------------------------------------------------------------------------------------------------
   PostgreSQL 11beta2 (Debian 11~beta2-1.pgdg90+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
  (1 row)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15262: "unexpected end of tuplestore" error when using new GROUPS window function clause
@ 2018-07-09 22:29  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2018-07-09 22:29 UTC (permalink / raw)
  To: lukas.eder@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> This error can be reproduced easily as follows

>   postgres=# SELECT count(*) OVER (GROUPS 1 PRECEDING) FROM (VALUES (1),
> (2), (2)) t(v);
>   ERROR:  unexpected end of tuplestore

In an assert-enabled build I get an assert failure from this.  I think
this is the same problem Masahiko Sawada noted in

https://www.postgresql.org/message-id/CAD21AoDrWqycq-w_+Bx1cjc+YUhZ11XTj9rfxNiNDojjBx8Fjw@mail.gmail...

and as in that thread, I think what we really should be doing here is
giving a parse error.  What would you expect GROUPS mode to do without
an ORDER BY to define the grouping?

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15262: "unexpected end of tuplestore" error when using new GROUPS window function clause
@ 2018-07-10 07:29  Lukas Eder <lukas.eder@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Lukas Eder @ 2018-07-10 07:29 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

Am Di., 10. Juli 2018 um 00:29 Uhr schrieb Tom Lane <tgl@sss.pgh.pa.us>:

> I think what we really should be doing here is giving a parse error.


Yes, I agree. That's also what the SQL standard says.

ISO/IEC 9075-2:2016(E)
7.15 <window clause>
13 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.


> What would you expect GROUPS mode to do without an ORDER BY to define the
> grouping?


I had no expectations, was just playing around with the new syntax.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-07-10 07:29 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 09:04 BUG #15262: "unexpected end of tuplestore" error when using new GROUPS window function clause PG Bug reporting form <noreply@postgresql.org>
2018-07-09 22:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-07-10 07:29   ` Lukas Eder <lukas.eder@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox