Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3eOg-001QRd-2b for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2026 18:16:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3eOf-007ll1-0Y for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2026 18:16:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3eOe-007lkt-2v for pgsql-bugs@lists.postgresql.org; Fri, 20 Mar 2026 18:16:33 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3eOc-00000000Dls-3177 for pgsql-bugs@lists.postgresql.org; Fri, 20 Mar 2026 18:16:33 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-463a0e14abfso1181785b6e.2 for ; Fri, 20 Mar 2026 11:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774030589; cv=none; d=google.com; s=arc-20240605; b=d8MmMJgmuC7hVoqL3sZqUMtg2glwFDIoQfu1iahZInyKjEK0RGLAe9IliETcVxJOnS cvkJCmqpsgFEN+34IiiEHyn4CJG1OaXE4qBDuZ+1D6Cwu7pxwAY3urbygYyPxpUDFoGp JeqfOsBqCgQunShxm1Cre4YtF9trLnjaV1oSRmy3Fz/MZjMZcvL9vg76asX/EKSGx8jg 0nZqgCBukm/o4CRESCgAk+uOyeN15V78K0G8paMbtfsPQOWDPq9HrVeJPCWoLDYN73OX 86tNFh9C+iq4jkLtqT0ehQZW3ElB8s5wZyKmkLja+BWcDrdtQ4cZF42eHFj7lW49ut3D U++w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=SjRBoDdPQEfSkfTqDyGJ/qCtkPqS5ASCM13fM5gvMHs=; fh=/h5wb2+LE9WQoXnEZldHok0Pw8igsJf69RLty8nrnjo=; b=ZYv+e21Gatc1vspRDg8fR20HEoRxduZPIV6bLa5acI4hIXJRQweoaxuWTWq+qExJnY BHgDScoOdwRc0eWOYgzbW8mhfEn6UcvYdAmZePwfF1P+4JX2ViHOpqgg93tna85Z/cqO 3G+snZulpGQFe1uikgmStTR9g0TVcr0ONJQ88SvsKVz1y7I/4NX2NWvFLazMIQxawx2L B/NnGGamK6/6QhF5X0yazv7s8cLuMOQYw8kD886szKEuCCrVFCbJKcNPycuyrg1afeIp gQUNZH5vHnCF05G2P+v986IL14iMgdKvcGfXTboX0Y4EXquLzKT8G3GEjpYP8KSqgcuU v2MA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774030589; x=1774635389; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SjRBoDdPQEfSkfTqDyGJ/qCtkPqS5ASCM13fM5gvMHs=; b=kkQYFspkKSwAS2u1qViHPZuFzuq+TVVi+K9MSP3eU1zzo2wpzRhbcAXJw302rR0t85 1Nos4ApXigV6kg2R4+/zElHhpPXie2DGoCp9yQhgjs/QEt31z26ix8RmXkpapGkWwcVE AxDpANcsCG/5BqzNtcTByFiGu75cbUkFa8ZavJApqtmEIHKWIHHI03ynRKZQ8iMgslUf G7A4xcon8MRxcvu5NUCHfD4JaFAnv5YV5UhiL2ZE3U20V4WZ9FNWfcU+Ol9KjxvZ1Lz+ JDGgqt/VNHiV2+9QKIXoDKiPQxDKaN+xsPnAIqFxl2KZ4x3TN20IILL9Bf7ggtYgFNW9 tT7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774030589; x=1774635389; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SjRBoDdPQEfSkfTqDyGJ/qCtkPqS5ASCM13fM5gvMHs=; b=ch1TUM+vNOjk/UXPVJjJPUinbMTQB//1f1t/rLWclGO7PZV2lE/NHCbW3JzE5VJwru jtDU9H6AlWqK+bevcw9Afbib0BtoQGk+RhRCXjePoRj0rl2OgDX/05/bPyvOmXFQR1Fg UXkZjUm+jBHy8QiBiwKcZxLYsla3jIinsZVHhPpeRL14YF/+TG7lE670bQZMRGS0vzVf nHFHrJX9BWK8dzoMzH7imZNjH6YouW2M+atyLZyo3cbHwGnh4Dk+AgXjyq2QpRzKa/p6 CLba5XTo5BpccFvEjHBYQXarWuGJF3Z30uXRytdRwmNUp1N+FsA4o6JZ04wEH0oquzQG 4dFA== X-Forwarded-Encrypted: i=1; AJvYcCX2lBXYj861hy3CkskKP2CEkKCALTF9jAS7IGn3DklC4Q8e02jasRFEa6uCVHqM7XhZVWysnFMtIsJs@lists.postgresql.org X-Gm-Message-State: AOJu0Yy9bPfrtqPLhIWF8o4v8PYF5qoKDm0/PGbp3DNbJNnnUFK1ougM SVy8VD46b1IH2dYQ4/I72aIDb6ttDTDRstWnQgtuEF5kR0UPe7e8EJxgIxpxMPhP3i9YT8ZcLpW ROsxjEomFSQSKVLWiAWSnw0u6dAHESP4= X-Gm-Gg: ATEYQzyGtsB3qhP6xJCuBliShjO3k0w1pjToFbww3VkBIsAMZaNFV7u9PnF4T+XhHyO bUzphYuyTEUzsUXql0wFQl64VNcpPnouh8Y4wgOYHPuvLHVVCZ9Ej5NWwpeTIVKIubEgHePoMDa DaiEnqkPzw69Hnu6VcvnFqGQFUMo+qfTax+ZLbe7u929lvGEEt4PKIkC92pixUPkq42Bd7A09+I VYnoAUDbHBoATSW0jY4XDUZJEhFiVbyc1mc4Y94dcG0EvxbvrZrt2H0fvF2STRR/6B2TiNdYOj2 AgWELCdaHTWLug== X-Received: by 2002:a05:6808:a607:10b0:45e:e4c9:cdc7 with SMTP id 5614622812f47-467e5f412b1mr1791807b6e.27.1774030588889; Fri, 20 Mar 2026 11:16:28 -0700 (PDT) MIME-Version: 1.0 References: <19382-4c2060ffee72759b@postgresql.org> In-Reply-To: From: surya poondla Date: Fri, 20 Mar 2026 11:16:16 -0700 X-Gm-Features: AaiRm536Hf_MbjDHuCCDGRtfm81n4CFIV8E8qgiy78937vb_u4ZoC5A-ZT_qmeI Message-ID: Subject: Re: BUG #19382: Server crash at __nss_database_lookup To: songjinzhou Cc: dllggyx , pgsql-bugs Content-Type: multipart/alternative; boundary="000000000000124e65064d78af37" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000124e65064d78af37 Content-Type: text/plain; charset="UTF-8" Hi Songjinzhou, Thank you for reviewing the patch. You're correct that there is a minor inefficiency, once a tupDesc_identifier version mismatch is detected, the patch allocates new_values/new_nulls arrays and calls deconstruct_expanded_record() before knowing whether any field types actually differ. If the version changed but no field types changed (e.g., a constraint-only ALTER), we do unnecessary work and hit the if (!need_conversion) return late. That said, your suggestion is clean and correct. I can restructure the code to do a first pass over the TupleDesc attributes (which is pure metadata, no deconstruction needed) to set need_conversion, and only proceed with deconstruct_expanded_record() and array allocation if that returns true. This avoids any unnecessary memory allocation in that intermediate case. I'll post an updated patch with this improvement. Thanks again for the careful review! Regards, Surya Poondla --000000000000124e65064d78af37 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Songjinzhou,

Thank you for revi= ewing the patch.

You're correct that there is a minor inefficien= cy, once a tupDesc_identifier version mismatch is detected, the patch alloc= ates=C2=A0
new_values/new_nulls arrays and calls deconstruct_expanded_r= ecord() before knowing whether any field types actually differ.=C2=A0
=
If the version changed but no field types changed (e.g., a constraint-= only ALTER), we do unnecessary work and hit the if (!need_conversion) retur= n late.

That said, your suggestion is clean and correct. I can restr= ucture the code to do a first pass over the TupleDesc attributes (which is = pure metadata, no deconstruction needed) to set need_conversion,=C2=A0
and only proceed with deconstruct_expanded_record() and array allocat= ion if that returns true. This avoids any unnecessary memory allocation in = that intermediate case.

I'll post an updated patch with this imp= rovement.

Thanks again for the careful review!

Regards,=C2=A0=
Surya Poondla
--000000000000124e65064d78af37--