Re: sorting a union over inheritance vs pathkeys

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Glaesemann <grzm(at)seespotcode(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sorting a union over inheritance vs pathkeys
Date: 2014-06-25 22:33:32
Message-ID: 19758.1403735612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Glaesemann <grzm(at)seespotcode(dot)net> writes:
> Ive come across an issue when creating a union over tables which includes inheritance:
> CREATE TABLE events (event_id INT NOT NULL);
> -- CREATE TABLE
> CREATE UNIQUE INDEX events_event_id_key ON events (event_id);
> -- CREATE INDEX

> CREATE TABLE legacy_events (event_id INT NOT NULL);
> -- CREATE TABLE
> CREATE UNIQUE INDEX legacy_events_event_id_key ON legacy_events (event_id);
> -- CREATE INDEX

> CREATE TABLE events_2 () INHERITS (events);
> -- CREATE TABLE
> -- this index isn't necessary to reproduce the error
> CREATE UNIQUE INDEX events_2_event_id_key ON events_2 (event_id);
> -- CREATE INDEX

> SELECT event_id
> FROM (SELECT event_id
> FROM events
> UNION ALL
> SELECT event_id
> FROM legacy_events) _
> ORDER BY event_id;
> -- ERROR: could not find pathkey item to sort

Hm ... I can reproduce that in 9.3 but it seems fine in 9.4 and HEAD.
Don't know what's going on exactly.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Lumby 2014-06-25 23:01:26 Re: Extended Prefetching using Asynchronous IO - proposal and patch
Previous Message Alvaro Herrera 2014-06-25 22:04:48 Re: better atomics - v0.5