Re: BUG #19382: Server crash at __nss_database_lookup

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: songjinzhou <tsinghualucky912(at)foxmail(dot)com>, dllggyx <dllggyx(at)outlook(dot)com>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19382: Server crash at __nss_database_lookup
Date: 2026-04-04 12:42:20
Message-ID: D9FAF41E-8082-47AF-B36E-4FB9EAF8378B@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 3 Apr 2026, at 04:14, surya poondla <suryapoondla4(at)gmail(dot)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 Content-Type Size
v2026-04-04-0001-Fix-incorrect-results-when-composite-typ.patch application/octet-stream 9.4 KB

In response to

Browse pgsql-bugs by date

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