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 1w2PXx-000GVt-0z for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 08:13:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2PXw-00H5xM-0W for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 08:13:00 +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 1w2PXv-00H5xD-2N for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 08:12:59 +0000 Received: from mail-dy1-x1329.google.com ([2607:f8b0:4864:20::1329]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2PXs-000000009Xl-14Kf for pgsql-hackers@postgresql.org; Tue, 17 Mar 2026 08:12:58 +0000 Received: by mail-dy1-x1329.google.com with SMTP id 5a478bee46e88-2beab594d8eso8785324eec.0 for ; Tue, 17 Mar 2026 01:12:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773735177; cv=none; d=google.com; s=arc-20240605; b=cy9K8seYTnUV/Et0UvBfN01vpPlfqsFfRU4VlYAGhsWbFlaIIVEYvsoZyBCzuu74gY fEyijXppiARRfOYRAIioYac2kuaKLrxTDS4s7tgDC+j9oGZBNIDXvLbxJ6kOSKaWK3a+ WCs1qfzsXUKvfkPacjOT+qVOQz1jI4FAX+jQxxqDTI7nuLoibH3XY6JbRpwBI0k8OEaq sghbYZIkarQKU1DfHZFzEZTYT7e6Gw+G/aSWKwCNGQIyKJqQmYEzbNy0QKEw9+zoIis9 FHWqU20sEbxVKnX9QH6pXvTEiwupulYBH7iheAZNH5Vr/Fs13ChXpnZF6fJUgxZAQ5j+ B51A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2L684ZCwzz7aT6JbeDjaB2bDy1MilfAQHHH/IQOG6m4=; fh=BAdbbDBd+qVxC8AcF/DShhJuzaQAeh+mj0RxwUAiKzU=; b=lPPvk1JV0olMXNyMjwud4YuhiQUtO46vXHSBCXmya7H7gXUTC3/w4ScNaoFb5rz8E5 SfGj23eY2/Td+UY1WqeYJKoFR+sRvrkbWbAqdZeiloznWh0V6tvU4SA5bCdhpM+P3/fv mbDGFLX9HPtyqiZK4aknKZtf+wZjj8SicGQyAybWNjw6S9v7uO+fvgQGVhLmB1MAWYiy E+RU+b4VlbzFeBCZX2+6uUC54J0Yp1NEpPnrRBsoxsHUM57JwGP6YGFia0Fc/E7dn1yF FgAdBRQsgY18xkyDsbCBlVhqX+jmOM/QYZ+DmNM8lSpwP4fDm14o1A8avFZZ+IUOiWam iqlg==; darn=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=1773735177; x=1774339977; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2L684ZCwzz7aT6JbeDjaB2bDy1MilfAQHHH/IQOG6m4=; b=fT3OUX8YDyse4vFJsg7ddSt/zAZlDknUXTVsjUvjWimNrI4hiJtei89rpAwagvTWzA tNcYKbvzZZRC77daHoUSglcnytrTOybqxACgDoujFLe5gzYCts6VX6/DrkCnotV9/Si5 T1/1Pv3aJQGG282pYlZrnNQYj/rhoozWhlLbNjuoDIz/qSo7z/f0H29lFCJtWAwD/Ier LhLMWMILyqUvWu9HA2/jnBRGQ1s14Ulxoai6NS+LJRD2Jx4kI474G0KnQ1L/unokbNJn jgAl3CaZDZlUjC2+saxBJO2BGWfphbW7TbJ7nwG0VlEmuJnPAsxRz/yu8ZkCYD3TGBWq SiOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773735177; x=1774339977; h=content-transfer-encoding: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=2L684ZCwzz7aT6JbeDjaB2bDy1MilfAQHHH/IQOG6m4=; b=JizcTRMa60tkDHOza7ffcoUcU3n63hBYB3c09zZAhSwOzJexZnioazaWZH63MARxEb qyINQCvsL54bTyg45LQP7k1R+L412SfcL6C9hID4SQsb0zxqFMo5rWb5f+ibIUh8Sy0T n83XsT6hdFXYD4Qa3AfazPutyk5jmXTA3tMOhFWa91ELG45lKWURuOgnDltg7gsELRMJ jIIf5d3vmVbD7e9oLEsjqSqpuI0P5faQJ8G9vs1rxwj9VSpBTAvSdGJfv/GK3AP3J2K8 VYCQNVHciCkFJTBjxjdtMFJkZU8TtJnqPmM5uoGIwKTgfNLx9UggPRFz5eACu8EdxDh1 aYZQ== X-Gm-Message-State: AOJu0YxSgGoNrdbmMa8A85L5JrF9uahp1mjOMZjpdxWhupFdJX0qRUMQ MRqeInciEUqSo8xicTzG5G7MtHquwGwr+E44SQuqjwxtUB6F/MMAgWAz2A7C064zxcusPQtfZ0J KSVt5mBdTlGCmYFS3h+ydiOvU4qYedNw= X-Gm-Gg: ATEYQzwYKnkd2GhLbyVt++TXZLplsO8kq8D1IcpeDgE0va0T2I0H/Ok+bJVlEshQOnn aZdlAfMnkYOqAnMdPx5IImVrkzCpunY5bhioYjB2xlruiqeiExWCUgLF1Hdc8uniAiSA1JznBYn FI6EAFp4jlgYzCcsfWvf9BFfe99d3J2S6JP3OBzxsbI3luitMElBFVOu1JFIkc/51r0elN3X8l1 Z1IWMn2frIgLiLIaZaWfMvIVirFVml2hPPNxRF4TAcGPVETBx3lr7D7SXg2hDSigMlf/8+TiyZh zhOMonU= X-Received: by 2002:a05:7300:6da5:b0:2c0:bfe8:6830 with SMTP id 5a478bee46e88-2c0bfe86c5emr3733221eec.20.1773735176671; Tue, 17 Mar 2026 01:12:56 -0700 (PDT) MIME-Version: 1.0 References: <6E6BD43A-89D5-457D-8825-E7282422802F@gmail.com> In-Reply-To: <6E6BD43A-89D5-457D-8825-E7282422802F@gmail.com> From: Nazir Bilal Yavuz Date: Tue, 17 Mar 2026 11:12:45 +0300 X-Gm-Features: AaiRm53VJfiDGu2cBMe72pUQ9GCpzxgqnHXNyf_tp_w_S2lDo1n_pjeuLGTuzqA Message-ID: Subject: Re: tupdesc: simplify assert in equalTupleDescs() To: Chao Li Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Tue, 17 Mar 2026 at 10:22, Chao Li wrote: > > While reading the code, I saw these assertions in equalTupleDescs(): > ``` > CompactAttribute *cattr1 =3D TupleDescCompactAttr(tupdesc= 1, i); > CompactAttribute *cattr2 =3D TupleDescCompactAttr(tupdesc= 2, i); > > Assert(cattr1->attnullability !=3D ATTNULLABLE_UNKNOWN); > Assert((cattr1->attnullability =3D=3D ATTNULLABLE_UNKNOWN= ) =3D=3D > (cattr2->attnullability =3D=3D ATTNULLABLE_UNK= NOWN)); > > ``` > > The first assertion already guarantees that cattr1->attnullability is not= ATTNULLABLE_UNKNOWN, so in the second one the expression cattr1->attnullab= ility =3D=3D ATTNULLABLE_UNKNOWN will always be false, That means the secon= d assertion is effectively just checking that cattr2->attnullability is als= o not ATTNULLABLE_UNKNOWN. > > So the current code is correct, but it feels a bit harder to read than ne= cessary. This patch just simplifies the second assertion in a direct way. Thank you for the report! You are right and the patch looks good to me. Nitpick: It is still a bit hard to understand why 'cattr2->attnullability' should not be equal to 'ATTNULLABLE_UNKNOWN'. It would be good to add a comment explaining that 'attr2->attnotnull' should be true too because 'if (attr1->attnotnull !=3D attr2->attnotnull)' is returning false. --=20 Regards, Nazir Bilal Yavuz Microsoft