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 1wW2Yo-002LrI-1u for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jun 2026 01:44:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wW2Yl-00GkvV-1j for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jun 2026 01:44:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wW2Yl-00GkvL-0V for pgsql-hackers@lists.postgresql.org; Sun, 07 Jun 2026 01:44:19 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wW2Yi-00000001TOk-2clC for pgsql-hackers@lists.postgresql.org; Sun, 07 Jun 2026 01:44:17 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2bf0ddaf50fso21309945ad.1 for ; Sat, 06 Jun 2026 18:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780796654; x=1781401454; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lfNuaf++7BTGR+tPiB/nm3a8fmwAx/UbLiDPVyENNsg=; b=jyF3ZOV0UIYsNWqfBWXVbVOMEWhEE4o6ur98cAKcFq2XB2DDs0CKpFZuU1mUv7i72T AT5aKbd8VbAKXSJPpmJeBG4kni6lPYROeLZ+UYTqimWDP6YXy6+SWJDS7QVmFol7zB3y Ap/sxmq4jPCjeju1pNJ7EP0TBzX1vsJ2j7zUgh3OxaSHdwOPOCQrLgfq5kIPpB/SMu5X qATfkDY2SgmqutlDFY/+YPVtMysvRIVJMQywJ6IiqLb5+W0uQ4W7xR0zBV8CJ3FE5a5p YhoevdxHELUxwjTRxLD2qJa5G3YREQm82FU3tQjoNSInkD9yHrV+zedUyV5yeqS2FGWH TPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780796654; x=1781401454; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lfNuaf++7BTGR+tPiB/nm3a8fmwAx/UbLiDPVyENNsg=; b=ods4ffOcjaZPUWphTF0DbklqAhplBKyQBA3t2ua/KesuJoNjfw35NZzAH1EmRpNKdJ gk+o3bUVWueUQ7XQWTporlRCJ34VBGt7gMAq209owBNdX0VsupIV/msurubX49sfqTt9 8z+o5+w4/84uE8zo2bCC+DkNS5wo/ub/1/OHjVuqWIGRo+dD5NGMRksMlDoUmcuudUCb xpnGLazzabvq8qZBD/ok6NvNSEqXcf0RWqQZGPC1YynjdoosSfOP0dK3JIwwFvtZiTFD /xMC23UQFx8jPMR4G6SLBvYujaSpiHrFRloxiY3XCWkOoq3dwA8tERK8RydGfv9UfBDm bHfA== X-Gm-Message-State: AOJu0YxiSdx2xBz2qzOQgKWpDe2IC9f0+Y+gRqxeFvDq+hSoAOXPooT5 0byEVWeSUQEAlbDnb0MM+jkLMZ2yOyMbOyCuPpp6XnqmjckjY6DjDwko X-Gm-Gg: Acq92OFGuUJyN1dgJTCOp8l9BJcllNSomP+ffaWWb1k/a4LAC2GEqKkq6XcmLbGokmf BR7DJ9/7q3Q+uuQAywaKf3R0S7G+0RyXhbFHSqQrJGyWIP7Tu5riWRiYQK8ExDaDeoHEi2RvP8t OVHbRUj9QdXWgSd/2+MWJPbNjWM/XjLKKMOOIyZ2iKCsCKmdgnBYrtMxLOwd0dTjMBpYIwaWsxO IZElmSh4+5fEdXtMj1zwPSG0E7XsJl3F0rTguraAGfD+WRCbvav/0/y67MIXbJNIS22jQapZ9Q6 Y8DHZd5ccyEDBbEn26lUsgrUd9w+mGhWn3vzlz3/Bnl830YCwqSSm/flYoja107411SFxgN/qIG h4k+E7sGc5cE4f9NWV4PtOX1jLyWHu5E2hv2ukUMIG9IbZmziDKyoE7G+GN1kRvIzQHhWdGagUv MI/5aS5ZLdBrUB2NoI/nT2Z993vycVc+1KIcz9x+aV1g== X-Received: by 2002:a17:903:3805:b0:2b2:57f3:8d07 with SMTP id d9443c01a7336-2c1e78e4d1bmr126711185ad.7.1780796654394; Sat, 06 Jun 2026 18:44:14 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c245dd3b5dsm12155855ad.81.2026.06.06.18.44.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Jun 2026 18:44:13 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: Fix tuple deformation with virtual generated NOT NULL columns From: Chao Li In-Reply-To: Date: Sun, 7 Jun 2026 09:43:34 +0800 Cc: Postgres hackers Content-Transfer-Encoding: quoted-printable Message-Id: <981D66D0-1185-4319-9C32-9317966C8A02@gmail.com> References: To: David Rowley X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jun 6, 2026, at 12:50, David Rowley wrote: >=20 > On Thu, 4 Jun 2026 at 17:57, Chao Li wrote: >> While testing "Optimize tuple deformation=E2=80=9D, I found a bug: >=20 >> I think the problem is in finding the first non-guaranteed attribute = where virtual generated attributes are not considered: >=20 > Thanks for the report and fix. I pushed a slightly adjusted version. Thanks for pushing. > Form_pg_attribute.attgenerated is '\0' for non-generated columns, so > there's no point in checking cattr->attgenerated as well as that. >=20 I was trying to avoid unconditionally fetching TupleDescAttr(tupdesc, = i), since cattr->attgenerated is already available and most columns = won't be virtual generated columns. But I was probably overthinking the = performance angle here. TupleDescFinalize() runs only when finalizing a = tuple descriptor, not during per-tuple deformation. I agree your = adjusted version is cleaner. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/