From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: xinwen@stu.scu.edu.cn
Subject: BUG #17777: An assert failed in nodeWindowAgg.c
Date: Mon, 06 Feb 2023 14:48:44 +0000
Message-ID: <17777-860b739b6efde977@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17777
Logged by: Anban Company
Email address: xinwen@stu.scu.edu.cn
PostgreSQL version: 15.1
Operating system: Ubuntu 20.04
Description:
When executing the following query,assert failed may be triggered, which
may be related to RANDOM():
CREATE TABLE table0 ( column0 INT ) ;
INSERT INTO table0 VALUES ( 1 ) , ( 2 ) , ( 3 ) , ( 4 ) , ( 5 ) , ( 6 ) , (
7 ) , ( 8 ) , ( 9 ) , ( 10 ) ;
SELECT WIDTH_BUCKET ( SUM ( 1 ) FILTER ( WHERE ( SELECT LAG ( TRUE , CAST (
RANDOM ( ) AS INT ) , column0 <= 1 ) OVER ( ) ) ) OVER ( PARTITION BY 1
ORDER BY column0 RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING ) , 1 , 2 , 3 )
FROM table0 ;
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@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007fab725fa859 in __GI_abort () at abort.c:79
#2 0x0000564bcbd68a88 in ExceptionalCondition
(conditionName=conditionName@entry=0x564bcbec5788
"peraggstate->transValueCount > 0", errorType=errorType@entry=0x564bcbdc64a0
"FailedAssertion", fileName=fileName@entry=0x564bcbec56b8
"/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/nodeWindowAgg.c",
lineNumber=lineNumber@entry=475) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/utils/error/assert.c:69
#3 0x0000564bcbae93ad in advance_windowaggregate_base
(winstate=0x564bcc969c20, perfuncstate=0x564bcc9a5610,
peraggstate=0x564bcc9a56a8) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/nodeWindowAgg.c:475
#4 0x0000564bcbaec69c in eval_windowaggregates (winstate=0x564bcc969c20) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/nodeWindowAgg.c:833
#5 ExecWindowAgg (pstate=0x564bcc969c20) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/nodeWindowAgg.c:2240
#6 0x0000564bcbaacc93 in ExecProcNode (node=0x564bcc969c20) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/include/executor/executor.h:259
#7 ExecutePlan (execute_once=<optimized out>, dest=0x564bcc989240,
direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>,
operation=CMD_SELECT, use_parallel_mode=<optimized out>,
planstate=0x564bcc969c20, estate=0x564bcc97ce10) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/execMain.c:1636
#8 standard_ExecutorRun (queryDesc=0x564bcc8c35c0, direction=<optimized
out>, count=0, execute_once=<optimized out>) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/executor/execMain.c:363
#9 0x0000564bcbc3fe5f in PortalRunSelect (portal=0x564bcc90f560,
forward=<optimized out>, count=0, dest=<optimized out>) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/tcop/pquery.c:924
#10 0x0000564bcbc41431 in PortalRun (portal=portal@entry=0x564bcc90f560,
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true,
run_once=run_once@entry=true, dest=dest@entry=0x564bcc989240,
altdest=altdest@entry=0x564bcc989240, qc=0x7ffebb433880) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/tcop/pquery.c:768
#11 0x0000564bcbc3d202 in exec_simple_query ( query_string=0x564bcc8a2010
"SELECT WIDTH_BUCKET ( SUM ( 1 ) FILTER ( WHERE ( SELECT LAG ( TRUE , CAST (
RANDOM ( ) AS INT ) , column0 <= 1 ) OVER ( ) ) ) OVER ( PARTITION BY 1
ORDER BY column0 RANGE BETWEEN CURRENT ROW AND 1 FOL"...) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/tcop/postgres.c:1250
#12 0x0000564bcbc3ef8c in PostgresMain (dbname=<optimized out>,
username=<optimized out>) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/tcop/postgres.c:4581
#13 0x0000564bcbbabe8a in BackendRun (port=<optimized out>, port=<optimized
out>) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/postmaster/postmaster.c:4504
#14 BackendStartup (port=<optimized out>) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/postmaster/postmaster.c:4232
#15 ServerLoop () at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/postmaster/postmaster.c:1806
#16 0x0000564bcbbacffb in PostmasterMain (argc=<optimized out>,
argv=0x564bcc89c310) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/postmaster/postmaster.c:1478
#17 0x0000564bcb8d7630 in main (argc=3, argv=0x564bcc89c310) at
/home/postgres/postgresql-15.1/original_bin-15.1/../src/backend/main/main.c:202
I also find this assert failed in 14.6, 13.9, 12.13 and 11.18 using the same
statement.
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, xinwen@stu.scu.edu.cn
Subject: Re: BUG #17777: An assert failed in nodeWindowAgg.c
In-Reply-To: <17777-860b739b6efde977@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