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-16 12:00:14
Message-ID: CC383BAA-1653-427A-975C-D27E2702E1E2@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 9 Apr 2026, at 09:24, surya poondla <suryapoondla4(at)gmail(dot)com> wrote:
>
> <0005-Fix-bug-19382-server-crash-when-ALTER-TYPE-is-used-m.patch>

I’ve took a look into the patch and here are some thoughts:

1. collect_composite_type_versions() does this
/* Resolve domain types to their base type */
if (typtype == TYPTYPE_DOMAIN)
{
attrtypid = getBaseType(attrtypid);
typtype = get_typtype(attrtypid);
}

Only for nested types. Do we need this for root?

2. When we do this

/* Clear composite type snapshot */
rec->nCompTypes = 0;
rec->compTypeOids = NULL;
rec->compTypeVersions = NULL;

We also might need two pfree()s.

3. Here are few other test cases that crash with the patch.

-- Case 5: Dot assignment
create type bug19382_foo3 as (a int, b int);
create function bug19382_test_field_assign() returns record as $$
declare r bug19382_foo3;
begin
r.a := 123;
r.b := power(2, 30)::int4;
alter type bug19382_foo3 alter attribute b type text;
return r;
end;
$$ language plpgsql;
select bug19382_test_field_assign();
drop function bug19382_test_field_assign();
drop type bug19382_foo3 cascade;

-- Case 6: SELECT INTO field also bypasses snapshot.
create type bug19382_foo4 as (a int, b int);
create table bug19382_tbl (a int, b int);
insert into bug19382_tbl values (123, power(2, 30)::int4);
create function bug19382_test_select_into_field() returns record as $$
declare r bug19382_foo4;
begin
select a, b into r.a, r.b from bug19382_tbl;
alter type bug19382_foo4 alter attribute b type text;
return r;
end;
$$ language plpgsql;
select bug19382_test_select_into_field();
drop function bug19382_test_select_into_field();
drop table bug19382_tbl;
drop type bug19382_foo4 cascade;

Thanks!

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2026-04-16 17:58:40 Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c"
Previous Message Andrei Lepikhov 2026-04-16 08:26:01 Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c"