pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #18878: PostgreSQL triggers Assertion Failure in Debug build 2+ messages / 2 participants [nested] [flat]
* BUG #18878: PostgreSQL triggers Assertion Failure in Debug build @ 2025-04-04 19:15 PG Bug reporting form <noreply@postgresql.org> 0 siblings, 1 reply; 2+ messages in thread From: PG Bug reporting form @ 2025-04-04 19:15 UTC (permalink / raw) To: pgsql-bugs@lists.postgresql.org; +Cc: luy70@psu.edu The following bug has been logged on the website: Bug reference: 18878 Logged by: Yu Liang Email address: luy70@psu.edu PostgreSQL version: 17.4 Operating system: Ubuntu 24.04 LTS ARM64 VM Description: In the debug build of PostgreSQL 17.4, compiled with `configure --enable-debug --prefix=$(pwd) --exec-prefix=$(pwd) --enable-cassert`, triggered Assertion Failure when executing the following statement: ```sql WITH RECURSIVE ta01 AS NOT MATERIALIZED ( WITH RECURSIVE any_cte_name AS MATERIALIZED ( TABLE ta01 ) DELETE FROM v00 RETURNING *, CASE WHEN FALSE THEN TRUE WHEN FALSE THEN TRUE ELSE TRUE END IDENT ) SELECT FROM JSON_ARRAY ( TABLE v00 ORDER BY CASE WHEN FALSE THEN TRUE END NULLS FIRST FOR READ ONLY) GROUP BY ROLLUP ( CASE WHEN FALSE NOT BETWEEN ASYMMETRIC CASE WHEN FALSE THEN TRUE END AND FALSE <> CASE WHEN EXISTS ( SELECT GROUP BY ALL ( ) FOR READ ONLY ) > CASE WHEN FALSE THEN TRUE END THEN FALSE END IS NULL THEN ARRAY ( ( TABLE ta01 ) ) ELSE CASE WHEN TRUE BETWEEN EXISTS ( SELECT GROUP BY ALL ( ) FOR READ ONLY ) AND TRUE IS NOT FALSE > EXISTS ( SELECT ALL GROUP BY ( ) FOR READ ONLY ) THEN TRUE END > CASE WHEN FALSE THEN TRUE END END ) FOR READ ONLY; ``` The triggered assertion is: "cte->cterecursive || !rte->self_reference". "src/backend/parser/parse_relation.c", Line: 2338. ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18878: PostgreSQL triggers Assertion Failure in Debug build @ 2025-04-05 19:07 Tom Lane <tgl@sss.pgh.pa.us> parent: PG Bug reporting form <noreply@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2025-04-05 19:07 UTC (permalink / raw) To: luy70@psu.edu; +Cc: pgsql-bugs@lists.postgresql.org PG Bug reporting form <noreply@postgresql.org> writes: > In the debug build of PostgreSQL 17.4, compiled with `configure > --enable-debug --prefix=$(pwd) --exec-prefix=$(pwd) --enable-cassert`, > triggered Assertion Failure when executing the following statement: > ```sql > WITH RECURSIVE ta01 AS NOT MATERIALIZED ( WITH RECURSIVE any_cte_name AS > MATERIALIZED ( TABLE ta01 ) DELETE FROM v00 RETURNING *, CASE WHEN FALSE > THEN TRUE WHEN FALSE THEN TRUE ELSE TRUE END IDENT ) SELECT FROM JSON_ARRAY > ( TABLE v00 ORDER BY CASE WHEN FALSE THEN TRUE END NULLS FIRST FOR READ > ONLY) GROUP BY ROLLUP ( CASE WHEN FALSE NOT BETWEEN ASYMMETRIC CASE WHEN > FALSE THEN TRUE END AND FALSE <> CASE WHEN EXISTS ( SELECT GROUP BY ALL ( ) > FOR READ ONLY ) > CASE WHEN FALSE THEN TRUE END THEN FALSE END IS NULL THEN > ARRAY ( ( TABLE ta01 ) ) ELSE CASE WHEN TRUE BETWEEN EXISTS ( SELECT GROUP > BY ALL ( ) FOR READ ONLY ) AND TRUE IS NOT FALSE > EXISTS ( SELECT ALL GROUP > BY ( ) FOR READ ONLY ) THEN TRUE END > CASE WHEN FALSE THEN TRUE END END ) > FOR READ ONLY; > ``` This can be reduced to WITH RECURSIVE ta01 AS ( WITH any_cte_name AS ( TABLE ta01 ) DELETE FROM v00 RETURNING * ) TABLE ta01; That should be rejected, because ta01 has a self-reference and is not in the allowed form "base-case UNION query-with-self-reference". However, we managed to miss the appearance of the self-reference because the code in charge of detecting it hadn't been taught that WITH is now allowed in INSERT/UPDATE/DELETE. (Which is a bit disheartening, but there you have it.) Fixed, thanks for the report! regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-04-05 19:07 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-04-04 19:15 BUG #18878: PostgreSQL triggers Assertion Failure in Debug build PG Bug reporting form <noreply@postgresql.org> 2025-04-05 19:07 ` Tom Lane <tgl@sss.pgh.pa.us>
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