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 CC383BAA-1653-427A-975C-D27E2702E1E2@yandex-team.ru
Whole thread
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 9 Apr 2026, at 09:24, surya poondla <suryapoondla4@gmail.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.


pgsql-bugs by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c"
Next
From: Masahiko Sawada
Date:
Subject: Re: TRAP: failed Assert("offsets[i] > offsets[i - 1]"), File: "tidstore.c"