From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs
Date: Sat, 02 Jan 2021 15:00:00 +0000
Message-ID: <16801-393c7922143eaa4d@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16801
Logged by: Alexander Lakhin
Email address: exclusion@gmail.com
PostgreSQL version: 13.1
Operating system: Ubuntu 20.04
Description:
When executing the following query:
WITH RECURSIVE rec(x) AS (
WITH outermost(x) AS (
SELECT (
WITH innermost as (SELECT 1)
SELECT * FROM innermost
)
)
SELECT * FROM outermost
)
SELECT * FROM rec;
valgrind detects an invalid read:
==00:00:00:04.145 217144== Invalid read of size 8
==00:00:00:04.145 217144== at 0x302CB7: makeDependencyGraphWalker
(parse_cte.c:549)
==00:00:00:04.145 217144== by 0x302EA1: makeDependencyGraph
(parse_cte.c:439)
==00:00:00:04.145 217144== by 0x304557: transformWithClause
(parse_cte.c:176)
==00:00:00:04.145 217144== by 0x2DD70A: transformSelectStmt
(analyze.c:1202)
==00:00:00:04.145 217144== by 0x2DDAB4: transformStmt (analyze.c:301)
==00:00:00:04.145 217144== by 0x2DEDDA: transformOptionalSelectInto
(analyze.c:246)
==00:00:00:04.145 217144== by 0x2DEE0F: transformTopLevelStmt
(analyze.c:196)
==00:00:00:04.145 217144== by 0x2DEE71: parse_analyze (analyze.c:116)
==00:00:00:04.145 217144== by 0x55E69F: pg_analyze_and_rewrite
(postgres.c:691)
==00:00:00:04.145 217144== by 0x55ED66: exec_simple_query
(postgres.c:1155)
==00:00:00:04.145 217144== by 0x560D83: PostgresMain (postgres.c:4315)
==00:00:00:04.145 217144== by 0x4CC6B8: BackendRun (postmaster.c:4526)
==00:00:00:04.145 217144== Address 0x50890a8 is 24 bytes inside a block of
size 32 client-defined
==00:00:00:04.145 217144== at 0x6B4831: palloc (mcxt.c:974)
==00:00:00:04.145 217144== by 0x42B624: new_list (list.c:134)
==00:00:00:04.145 217144== by 0x42BF1B: lcons (list.c:458)
==00:00:00:04.145 217144== by 0x302C73: makeDependencyGraphWalker
(parse_cte.c:542)
==00:00:00:04.145 217144== by 0x302EA1: makeDependencyGraph
(parse_cte.c:439)
==00:00:00:04.145 217144== by 0x304557: transformWithClause
(parse_cte.c:176)
==00:00:00:04.145 217144== by 0x2DD70A: transformSelectStmt
(analyze.c:1202)
==00:00:00:04.145 217144== by 0x2DDAB4: transformStmt (analyze.c:301)
==00:00:00:04.145 217144== by 0x2DEDDA: transformOptionalSelectInto
(analyze.c:246)
==00:00:00:04.145 217144== by 0x2DEE0F: transformTopLevelStmt
(analyze.c:196)
==00:00:00:04.145 217144== by 0x2DEE71: parse_analyze (analyze.c:116)
==00:00:00:04.145 217144== by 0x55E69F: pg_analyze_and_rewrite
(postgres.c:691)
==00:00:00:04.145 217144==
The first bad commit is 1cff1b95.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
Subject: Re: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs
In-Reply-To: <16801-393c7922143eaa4d@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox