Re: GROUP BY and inheritance issue

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: GROUP BY and inheritance issue
Date: 2019-07-03 22:11:55
Message-ID: CAKJS1f-aO06wUzjtgUrEmH9vayZf-Uq21=aV-NLaWCV2X36zhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 3 Jul 2019 at 01:13, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
>
> On Wed, 3 Jul 2019 at 00:47, Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> wrote:
> > Consider the example below:
> >
> > CREATE TABLE t0(c0 INT PRIMARY KEY, c1 INT);
> > CREATE TABLE t1(c0 INT) INHERITS (t0);
> > INSERT INTO t0(c0, c1) VALUES(0, 0);
> > INSERT INTO t1(c0, c1) VALUES(0, 1);
> > SELECT c0, c1 FROM t0 GROUP BY c0, c1; -- expected: 0|0 and 0|1, actual: 0|0
> >
> > Note that column c0 in t0 and t1 are merged. The GROUP BY clause above
> > causes only one row to be fetched, while I'd expect that both are
> > fetched (which is the behavior when no GROUP BY is used). Section
> > 5.9.1 [1] in the documentation mentions some caveats of using
> > inheritance, also stating that the PRIMARY KEY is not inherited. Is
> > this some implication of this or a bug?
>
> Thanks for the report. This is a bug.

I've pushed a fix for this.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-07-03 22:50:17 BUG #15892: URGENT: Using an ICU collation in a primary key column breaks ILIKE query
Previous Message Tom Lane 2019-07-03 14:49:48 Re: BUG #15891: Cannot alter columns and add constraints in one alter statement since 11.4 update