Re: BUG #19382: Server crash at __nss_database_lookup - Mailing list pgsql-bugs

From Andrey Borodin
Subject Re: BUG #19382: Server crash at __nss_database_lookup
Date
Msg-id D9FAF41E-8082-47AF-B36E-4FB9EAF8378B@yandex-team.ru
Whole thread Raw
In response to Re: BUG #19382: Server crash at __nss_database_lookup  (surya poondla <suryapoondla4@gmail.com>)
Responses Re: BUG #19382: Server crash at __nss_database_lookup
List pgsql-bugs

> On 3 Apr 2026, at 04:14, surya poondla <suryapoondla4@gmail.com> wrote:
>
> <0004-Fix-bug-19382-server-crash-when-ALTER-TYPE-is-used-m.patch>

Hi Surya,

Thanks for the updated patch. I noticed it checks er_tupdesc_id of the
outermost record variable, but does not recurse into nested composite types.
The server still crashes when only an inner type is altered:

CREATE TYPE inner_t AS (x INT, y INT);
CREATE TYPE outer_t AS (a INT, b inner_t);

CREATE OR REPLACE FUNCTION test_nested() RETURNS record LANGUAGE plpgsql AS $$
DECLARE r1 outer_t; r2 outer_t;
BEGIN
    r1 := ROW(1, ROW(10, power(2,30)::int4)::inner_t)::outer_t;
    ALTER TYPE inner_t ALTER ATTRIBUTE y TYPE TEXT;
    r2 := r1;
    RETURN r2;
END; $$;

SELECT test_nested();   -- server crash


The same gap exists on the cursor side independently of your patch, and I
have a fix for that part that walks the type tree recursively. IMO the
PL/pgSQL assignment path will need a similar recursive check.

I'm definitely not a big fan of checking types on every FETCH, but I see no
other ways around.


Best regards, Andrey Borodin.

Attachment

pgsql-bugs by date:

Previous
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: BUG #19360: Bug Report: Logical Replication initial sync fails with "conflict=update_origin_differs" PG12 toPG18
Next
From: Tomas Vondra
Date:
Subject: Re: BUG #19449: Massive performance degradation for complex query on Postgres 16+ (few seconds -> multiple hours)