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

From Andrey Zhidenkov
Subject Re: BUG #19108: Stack overflow duting query parse
Date
Msg-id CAN=gQ4DtU6fPEttn8KW5N2tUXYqHUNuPott_Ex7GCO7VqMsMxg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19108: Stack overflow duting query parse  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #19108: Stack overflow duting query parse
List pgsql-bugs
> Could you at least provide a not-mangled-to-the-point-of-incorrectness
version of the query?

Sure, here it is:

select "public"."dtn_v2"."uuid", "public"."dtn_v2"."first_shipment_date_route_original_departure_plan_date"
from "public"."dtn_v2"
         join "public"."shipment_v2" on ("public"."shipment_v2"."uuid" = "public"."dtn_v2"."first_shipment_uuid" and
                                         "public"."shipment_v2"."date_route_original_departure_plan_date" =
                                         "public"."dtn_v2"."first_shipment_date_route_original_departure_plan_date")
where ("public"."shipment_v2"."shipment_node_from_id", "public"."shipment_v2"."date_route_original_departure_plan_date") in
      ((39073021, cast('2025-09-10 06:15:00+00' as timestamp)), (40493380, cast('2025-10-23 06:15:00+00' as timestamp)),
       (38609801, cast('2025-08-27 04:30:00+00' as timestamp)), (39038517, cast('2025-09-09 06:15:00+00' as timestamp)),
       ...
       (40788851, cast('2025-11-01 06:15:00+00' as timestamp)), (39267833, cast('2025-09-16 04:30:00+00' as timestamp)));

BTW, there were "out of memory errors" before the segmentation fault. For instance:

could not fork autovacuum worker process: Cannot allocate memory

But I didn't think memory exhaustion could lead to errors like "segmentation fault".

Also "dnf install ..." command was also core dumped so maybe some shared memory segments were corrupted.

Thanks!

On Mon, Nov 10, 2025 at 7:02 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Andrey Zhidenkov <pensnarik@gmail.com> writes:
>> Can you create a self-contained SQL script to reproduce this, and post it
>> on this thread with reply-all, please?

> Unfortunately, I cannot reproduce the issue even on an existing 15.7
> node (one that hasn't upgraded) (don't know if it matters, but now it's a
> hot standby node) but there are core dumps and debug info packages
> installed so I can provide more data from core dump.

Could you at least provide a not-mangled-to-the-point-of-incorrectness
version of the query?  The posted one fails with

ERROR:  table name "tablename_v2" specified more than once

and there are other visible bugs in it.  Some clarity about the column
data types would be helpful as well.

                        regards, tom lane


--
С уважением, Андрей Жиденков.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19107: The hold cursor is unexpectedly released during rollback
Next
From: "zengman"
Date:
Subject: Re: BUG #19107: The hold cursor is unexpectedly released during rollback