Pg17 Crash in Planning (Arrays + Casting + UDF)

From: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Regina Obe <lr(at)pcorp(dot)us>, Fredrik Widlert <fredrik(dot)widlert(at)digpro(dot)se>
Subject: Pg17 Crash in Planning (Arrays + Casting + UDF)
Date: 2024-10-09 18:52:25
Message-ID: 518339E7-173E-45EC-A0FF-9A4A62AA4F40@cleverelephant.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

This extremely odd case [2] came in via a report using a lot of PostGIS functions, but it can be reconfigured into a pure-PostgreSQL crasher [1].

CREATE TABLE n (i integer);

CREATE OR REPLACE FUNCTION add(integer)
RETURNS integer
AS 'SELECT 2 * $1 + 4 * $1'
LANGUAGE 'sql' IMMUTABLE STRICT PARALLEL SAFE;

SELECT add(array_length(array_agg(i)::numeric[],1)::integer) FROM n;

The stack trace shows it doesn’t get past planning, and in fact it doesn’t care if the table has data in it or not.

ATB,

P

[1] https://trac.osgeo.org/postgis/ticket/5793#comment:8
[2] https://lists.osgeo.org/pipermail/postgis-devel/2024-October/030428.html

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2024-10-09 18:53:25 Re: [PATCH] Add some documentation on how to call internal functions
Previous Message Daniel Gustafsson 2024-10-09 18:30:20 Re: Remove deprecated -H option from oid2name