BUG #17826: An assert failed in /src/backend/optimizer/util/var.c

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: xinwen(at)stu(dot)scu(dot)edu(dot)cn
Subject: BUG #17826: An assert failed in /src/backend/optimizer/util/var.c
Date: 2023-03-09 09:10:58
Message-ID: 17826-7d8750952f19a5f5@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: 17826
Logged by: Anban Company
Email address: xinwen(at)stu(dot)scu(dot)edu(dot)cn
PostgreSQL version: 15.2
Operating system: Ubuntu 20.04
Description:

When executing the following query:

WITH table1 AS ( SELECT 1 ) SELECT 1 FROM ( SELECT RANK ( ) OVER ( ) column0
FROM table1 JOIN table1 AS alias0 ON TRUE ) AS alias1 WHERE ( CASE WHEN ( 1
IN ( SELECT 1 ) ) THEN 1 END = column0 ) ;

I get a failed assertion with the following stacktrace:

Core was generated by `postgres: postgres postgres [local] SELECT
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f68a29b6859 in __GI_abort () at abort.c:79
#2 0x0000555d7a2db598 in ExceptionalCondition
(conditionName=conditionName(at)entry=0x555d7a44c828 "!IsA(node, SubPlan)",
errorType=errorType(at)entry=0x555d7a3394a0 "FailedAssertion",
fileName=fileName(at)entry=0x555d7a4504b8
"/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/util/var.c",
lineNumber=lineNumber(at)entry=872) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/utils/error/assert.c:69
#3 0x0000555d7a105c41 in flatten_join_alias_vars_mutator
(node=0x555d7aa0f518, context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/util/var.c:872
#4 0x0000555d7a08cba9 in expression_tree_mutator (node=0x555d7aa07eb0,
mutator=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:3320
#5 0x0000555d7a08cff6 in expression_tree_mutator (node=0x555d7aa0f888,
mutator=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:3165
#6 0x0000555d7a08cef9 in expression_tree_mutator (node=0x555d7aa07e58,
mutator=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:3137
#7 0x0000555d7a08cff6 in expression_tree_mutator (node=0x555d7aa11ba0,
mutator=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:3165
#8 0x0000555d7a08ccab in expression_tree_mutator (node=0x555d7aa11400,
mutator=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:2780
#9 0x0000555d7a08cff6 in expression_tree_mutator (node=0x555d7aa11bf8,
mutator=mutator(at)entry=0x555d7a1057a0 <flatten_join_alias_vars_mutator>,
context=context(at)entry=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/nodes/nodeFuncs.c:3165
#10 0x0000555d7a105821 in flatten_join_alias_vars_mutator (node=<optimized
out>, context=context(at)entry=0x7fff50b0c980) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/util/var.c:878
#11 0x0000555d7a10602e in flatten_join_alias_vars (query=<optimized out>,
node=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/util/var.c:744
#12 0x0000555d7a0d4b79 in preprocess_expression
(root=root(at)entry=0x555d7aa11ca8, expr=<optimized out>, kind=kind(at)entry=1) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planner.c:1105
#13 0x0000555d7a0dcb8c in subquery_planner (glob=<optimized out>,
parse=parse(at)entry=0x555d7aa10058,
parent_root=parent_root(at)entry=0x555d7aa05f78,
hasRecursion=hasRecursion(at)entry=false, tuple_fraction=0) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planner.c:829
#14 0x0000555d7a0ac11e in set_subquery_pathlist (rte=<optimized out>,
rti=<optimized out>, rel=<optimized out>, root=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/path/allpaths.c:2601
#15 set_rel_size (root=<optimized out>, rel=<optimized out>, rti=<optimized
out>, rte=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/path/allpaths.c:425
#16 0x0000555d7a0ae980 in set_base_rel_sizes (root=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/path/allpaths.c:326
#17 make_one_rel (root=root(at)entry=0x555d7aa05f78,
joinlist=joinlist(at)entry=0x555d7aa0fe18) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/path/allpaths.c:188
#18 0x0000555d7a0d4976 in query_planner (root=root(at)entry=0x555d7aa05f78,
qp_callback=qp_callback(at)entry=0x555d7a0d5990 <standard_qp_callback>,
qp_extra=qp_extra(at)entry=0x7fff50b0ccb0) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planmain.c:276
#19 0x0000555d7a0da4f9 in grouping_planner (root=<optimized out>,
tuple_fraction=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planner.c:1470
#20 0x0000555d7a0dd145 in subquery_planner (glob=glob(at)entry=0x555d7aa047d8,
parse=parse(at)entry=0x555d7aa02e98, parent_root=parent_root(at)entry=0x0,
hasRecursion=hasRecursion(at)entry=false,
tuple_fraction=tuple_fraction(at)entry=0) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planner.c:1047
#21 0x0000555d7a0dd5a3 in standard_planner (parse=0x555d7aa02e98,
query_string=<optimized out>, cursorOptions=2048, boundParams=<optimized
out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/optimizer/plan/planner.c:406
#22 0x0000555d7a1af74c in pg_plan_query (querytree=0x555d7aa02e98,
query_string=0x555d7a93c010 "WITH table1 AS ( SELECT 1 ) SELECT 1 FROM (
SELECT RANK ( ) OVER ( ) column46 FROM table1 JOIN table1 AS alias0 ON TRUE
) AS alias1 WHERE ( CASE WHEN ( 1 IN ( SELECT 1 ) ) THEN 1 END = column46 )
;", cursorOptions=2048, boundParams=0x0) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/tcop/postgres.c:883
#23 0x0000555d7a1af841 in pg_plan_queries (querytrees=0x555d7aa05f20,
query_string=query_string(at)entry=0x555d7a93c010 "WITH table1 AS ( SELECT 1 )
SELECT 1 FROM ( SELECT RANK ( ) OVER ( ) column46 FROM table1 JOIN table1 AS
alias0 ON TRUE ) AS alias1 WHERE ( CASE WHEN ( 1 IN ( SELECT 1 ) ) THEN 1
END = column46 ) ;", cursorOptions=cursorOptions(at)entry=2048,
boundParams=boundParams(at)entry=0x0) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/tcop/postgres.c:975
#24 0x0000555d7a1afc4f in exec_simple_query ( query_string=0x555d7a93c010
"WITH table1 AS ( SELECT 1 ) SELECT 1 FROM ( SELECT RANK ( ) OVER ( )
column46 FROM table1 JOIN table1 AS alias0 ON TRUE ) AS alias1 WHERE ( CASE
WHEN ( 1 IN ( SELECT 1 ) ) THEN 1 END = column46 ) ;") at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/tcop/postgres.c:1169
#25 0x0000555d7a1b17fc in PostgresMain (dbname=<optimized out>,
username=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/tcop/postgres.c:4593
#26 0x0000555d7a11e5aa in BackendRun (port=<optimized out>, port=<optimized
out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/postmaster/postmaster.c:4511
#27 BackendStartup (port=<optimized out>) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/postmaster/postmaster.c:4239
#28 ServerLoop () at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/postmaster/postmaster.c:1806
#29 0x0000555d7a11f71b in PostmasterMain (argc=<optimized out>,
argv=0x555d7a936310) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/postmaster/postmaster.c:1478
#30 0x0000555d79e49510 in main (argc=3, argv=0x555d7a936310) at
/home/postgres/postgresql-15.2/original_bin-15.2/../src/backend/main/main.c:202

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-03-09 10:27:00 BUG #17827: Rule on insert into table doesn't work when excepting select from the table itself
Previous Message Alexander Lakhin 2023-03-09 09:00:00 Re: BUG #17368: Assert failed in GetSafeSnapshot() for SERIALIZABLE READ ONLY DEFERRABLE transaction