Re: BUG #19108: Stack overflow duting query parse - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #19108: Stack overflow duting query parse
Date
Msg-id e7c2340a-3a01-4095-b606-0e8e77384084@iki.fi
Whole thread Raw
In response to BUG #19108: Stack overflow duting query parse  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #19108: Stack overflow duting query parse
List pgsql-bugs
On 10/11/2025 13:13, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      19108
> Logged by:          Andrey Zhidenkov
> Email address:      pensnarik@gmail.com
> PostgreSQL version: 15.7
> Operating system:   Oracle Linux 8.4

15.7 is quite outdated, please upgrade to the latest minor version.

That said, I don't see any changes between 15.7 and 15.13 in the 
relevant code, so it probably won't make a difference. You're missing 
out on a bunch of other important fixes though.

> Description:
> 
> Hello everyone.
> 
> I had a stack overflow on my PostgreSQL production installation during query
> parsing:
> 
> 2025-11-05 19:04:58.749 +07 [477608] LOG:  server process (PID 633135) was
> terminated by signal 11: Segmentation fault
> 
> execution stack (from coredump):
> 
> (lines from 0 to 1021 are nested calls of assign_collations_walker ->
> expression_tree_walker.part)
> #1022 0x00000000006077d4 in assign_collations_walker ()
> #1023 0x00000000007099d3 in expression_tree_walker.part ()
> #1024 0x00000000006077d4 in assign_collations_walker ()
> #1025 0x00000000007099d3 in expression_tree_walker.part ()
> #1026 0x00000000006077d4 in assign_collations_walker ()
> #1027 0x00000000007099d3 in expression_tree_walker.part ()
> #1028 0x00000000006077d4 in assign_collations_walker ()
> #1029 0x00000000007099d3 in expression_tree_walker.part ()
> #1030 0x00000000006077d4 in assign_collations_walker ()
> #1031 0x00000000007099d3 in expression_tree_walker.part ()
> #1032 0x00000000006077d4 in assign_collations_walker ()
> #1033 0x00000000007099d3 in expression_tree_walker.part ()
> #1034 0x00000000006077d4 in assign_collations_walker ()
> #1035 0x00000000007099d3 in expression_tree_walker.part ()
> --Type <RET> for more, q to quit, c to continue without paging--
> #1036 0x00000000006077d4 in assign_collations_walker ()
> #1037 0x00000000007099d3 in expression_tree_walker.part ()
> #1038 0x00000000006077d4 in assign_collations_walker ()
> #1039 0x00000000007099d3 in expression_tree_walker.part ()
> #1040 0x00000000006077d4 in assign_collations_walker ()
> #1041 0x00000000006073bb in assign_collations_walker ()
> #1042 0x0000000000607cfd in assign_query_collations_walker ()
> #1043 0x000000000070a008 in query_tree_walker ()
> #1044 0x00000000005e4e86 in transformStmt ()
> #1045 0x00000000005e6ea1 in parse_analyze_varparams ()
> #1046 0x000000000080d67f in pg_analyze_and_rewrite_varparams ()
> #1047 0x000000000080e6f1 in PostgresMain ()
> #1048 0x000000000078eec0 in ServerLoop ()
> #1049 0x000000000078fe74 in PostmasterMain ()
> #1050 0x0000000000504d6d in main ()

Weird, there is a stack-depth check in expression_tree_walker() which 
should turn this into a graceful error.

Can you create a self-contained SQL script to reproduce this, and post 
it on this thread with reply-all, please?

- Heikki




pgsql-bugs by date:

Previous
From: Smolkin Grigory
Date:
Subject: clog segment truncation
Next
From: "Matheus Alcantara"
Date:
Subject: Re: clog segment truncation