Re: BUG #19108: Stack overflow duting query parse

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pensnarik(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, PG Bug reporting form <noreply(at)postgresql(dot)org>
Subject: Re: BUG #19108: Stack overflow duting query parse
Date: 2025-11-10 12:38:51
Message-ID: e7c2340a-3a01-4095-b606-0e8e77384084@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Matheus Alcantara 2025-11-10 13:05:26 Re: clog segment truncation
Previous Message Smolkin Grigory 2025-11-10 12:29:32 clog segment truncation