Re: Segmentation fault in var_is_nonnullable when running query with COUNT() on 42473b3b

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "Birler, Altan" <altan(dot)birler(at)tum(dot)de>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Segmentation fault in var_is_nonnullable when running query with COUNT() on 42473b3b
Date: 2025-11-29 19:43:46
Message-ID: CAApHDvqWH9Dm-ezcwFOax6qyqqS9T_EsDa96Do8Fj-1zdXJRhw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 30 Nov 2025 at 02:17, Birler, Altan <altan(dot)birler(at)tum(dot)de> wrote:
> PostgreSQL stand-alone backend 19devel
> backend> Segmentation fault (core dumped)
> ```
>
> I have tried to minimize the query and I still get an error with the following smaller query:
> ```
> SELECT 1 FROM (VALUES (NULL),(NULL)) AS t(key) GROUP BY key HAVING COUNT(key) = ANY (ARRAY[2]);
> ```

Thanks for the detailed report.

Looks like I didn't take into account the fact that context->root can
be NULL in some cases. In this case, when called via
estimate_expression_value().

I believe the attached is the correct fix.

David

Attachment Content-Type Size
fix_simplify_aggref.patch application/octet-stream 564 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2025-11-29 23:56:34 Re: Segmentation fault in var_is_nonnullable when running query with COUNT() on 42473b3b
Previous Message Birler, Altan 2025-11-29 09:12:34 Segmentation fault in var_is_nonnullable when running query with COUNT() on 42473b3b