SELECT with COLLATE results in segfault on trunk and 12 Beta 2 - Mailing list pgsql-bugs

From Manuel Rigger
Subject SELECT with COLLATE results in segfault on trunk and 12 Beta 2
Date
Msg-id CA+u7OA40Fe9=A3wQ2PHWy8VZg8=GpD6dxQXeXVDx6HAhRSPeRA@mail.gmail.com
Whole thread Raw
Responses Re: SELECT with COLLATE results in segfault on trunk and 12 Beta 2  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-bugs by date:

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