Re: BUG #19382: Server crash at __nss_database_lookup

From: surya poondla <suryapoondla4(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, songjinzhou <tsinghualucky912(at)foxmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Subject: Re: BUG #19382: Server crash at __nss_database_lookup
Date: 2026-07-15 22:16:35
Message-ID: CAOVWO5rJ8sAtrBytkTmawjpBpOR453zYh7n3vaj5FfWx=bMM5w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Zsolt,

Thanks for the sharp testing. Attached is v12 with a fix for one of your
two cases; the other needs more design work than a small amendment.

Case 2 (outer-type ALTER + reassign), fixed in v12. The false positive came
from er_tupdesc_id (set once at ExpandedRecord creation)
being left stale when the record was reassigned in place via
expanded_record_set_tuple.
v12 refreshes it at the same two in-place set_tuple sites where I already
added the nested-snapshot refresh.
Reassignment with fresh data now returns the row (matching master);
reassignment without a follow-up write still errors.

Case 1 (array-carried composite in a scalar PL/pgSQL variable) still open.
Confirmed still crashes on v12. The v11/v12 snapshot lives on PLpgSQL_rec;
here the stale bytes flow through arr foo[], which is a
PLpgSQL_var that is outside the current mechanism's scope.
A small point-fix doesn't cover this properly, because the same shape
extends to any
composite Datum that predates an ALTER (cursors, function args, temp table
rows, etc.).
I'd rather propose a design for this separately, likely a session-scoped
set of "types altered in this transaction" plus
a check at composite-read time. Happy to open a fresh thread on it.

Regards,
Surya Poondla

Attachment Content-Type Size
v12_003-Cover-generic-RECORD-variables-in-ALTER-TYPE-detecti.patch application/octet-stream 11.3 KB
v12_004-Detect-composite-types-reached-through-container-typ.patch application/octet-stream 10.6 KB
v12_002-Refresh-composite-type-state-on-in-place-record-reas.patch application/octet-stream 9.5 KB
v12_001-Detect-mid-transaction-ALTER-TYPE-on-PL-pgSQL-record.patch application/octet-stream 22.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2026-07-16 00:29:25 Re: Bug in heap_get_root_tuples
Previous Message Tom Lane 2026-07-15 19:12:45 Re: CREATE INDEX with an expression in an INCLUDE column fails with XX000 "unrecognized node type" instead of 0A000 on master