BUG #12146: Crash when using UNION ALL

From: me(at)jandrabek(dot)cz
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12146: Crash when using UNION ALL
Date: 2014-12-04 16:03:38
Message-ID: 20141204160338.2565.93893@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12146
Logged by: Jan Drabek
Email address: me(at)jandrabek(dot)cz
PostgreSQL version: 9.3.5
Operating system: OS X 10.10 (via Macports)
Description:

Since 9.3.5 my PostgreSQL crashes when certain pattern in queries appears.
(Version 9.3.4 is not affected.)

After cutting all dependencies and columns from table foo it is only having
one column with BIGINT type.

The query is:
SELECT *
FROM (
SELECT id
FROM (
SELECT id FROM foo
UNION ALL
SELECT id FROM foo

) t
UNION ALL

SELECT id FROM foo
) AS eop
JOIN foo p ON p.id = eop.id

After execution of this query I get this in PostgreSQL log:
LOG: server process (PID 11935) was terminated by signal 11: Segmentation
fault

However it is reproducible only on my machine (dumping database is of no
good).

Interesting observations:
- After executing ANALYZE foo; problems disappear (corrupted statistics?)
- Using UNION instead of UNION ALL makes it work.
- Duplicating database on my machine (via pgadmin dump and load) doesn't
change this behaviour (i.e. it still crashes even on the newly loaded
database).

However I wasn't able to reproduce problem on different machine.
Any ideas what to do next in order to find the cause? (I tried to use
DEBUG5, but there were nothing interesting in the log).

Thanks
jan Drábek

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-12-04 16:22:21 Re: BUG #12137: ORDER BY with expresion changes the output if added
Previous Message David G Johnston 2014-12-04 16:01:02 Re: BUG #12137: ORDER BY with expresion changes the output if added