SELECT with COLLATE results in segfault on trunk and 12 Beta 2

From: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: SELECT with COLLATE results in segfault on trunk and 12 Beta 2
Date: 2019-07-14 21:30:26
Message-ID: CA+u7OA40Fe9=A3wQ2PHWy8VZg8=GpD6dxQXeXVDx6HAhRSPeRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi everyone,

When executing the statements below, Postgres crashes:

CREATE TABLE t0(c0 BOOLEAN, c1 TEXT);
CREATE STATISTICS s1 ON c0, c1 FROM t0;
INSERT INTO t0(c0) VALUES (FALSE);
VACUUM ANALYZE t0;
SELECT * FROM t0 WHERE t0.c0 OR '' >= t0.c1 COLLATE "C"; -- unexpected: segfault

The server log on the latest trunk version (5925e55) shows the following:

2019-07-14 23:09:58.070 CEST [11236] LOG: server process (PID 11245)
was terminated by signal 11: Segmentation fault
2019-07-14 23:09:58.070 CEST [11236] DETAIL: Failed process was
running: SELECT * FROM t0 WHERE t0.c0 OR '' >= t0.c1 COLLATE "C";
2019-07-14 23:09:58.070 CEST [11236] LOG: terminating any other
active server processes

I could reproduce the segfault on the latest trunk version (PostgreSQL
13devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
8.3.0-6ubuntu1) 8.3.0, 64-bit), beta version (12beta2 (Debian
12~beta2-1.pgdg90+1)), but not on the latest release version (11.4
(Debian 11.4-1.pgdg90+1)). Since the bug is not reproducible on the
latest release version, I assume that this is not a security issue.

Best,
Manuel

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-07-14 22:22:50 Re: SELECT with COLLATE results in segfault on trunk and 12 Beta 2
Previous Message Rashid Abzalov 2019-07-13 13:12:07 Re: The statement is re-executed (performed twice) on commit if it is declared as "cursor with hold" and the cursor is not closed yet