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.98.2) (envelope-from ) id 1x8lrs-00000001Tbe-1Pjo for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Sep 2026 21:48:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x8lrr-0000000BX9K-2cku for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Sep 2026 21:48:07 +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.98.2) (envelope-from ) id 1x8lrr-0000000BX9C-1QK0 for pgsql-hackers@lists.postgresql.org; Mon, 21 Sep 2026 21:48:07 +0000 Received: from mail-wm2-x11.google.com ([2a00:1450:4864:31::11]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x8lrp-00000000ajY-0iUn for pgsql-hackers@postgresql.org; Mon, 21 Sep 2026 21:48:07 +0000 Received: by mail-wm2-x11.google.com with SMTP id 5b1f17b1804b1-49e79a408deso19916335e9.2 for ; Mon, 21 Sep 2026 14:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790027284; x=1790632084; darn=postgresql.org; h=in-reply-to:references:content-transfer-encoding:mime-version:to :from:cc:subject:message-id:date:content-type:from:to:cc:subject :date:message-id:reply-to:content-type; bh=z5JZc1dgLTzyazP060WQUuTKDJF15yUQFc5pQ6A1fqY=; b=CwSxYYTpn76BCqbJ+U/FvEITNG7C2U4LcLxwx34CHrLAv7L3D7PKi22ps60ci2iNsD tNx1svhqLF76zCXiil7uW0YDW8WdzBc/crbwGjdnGr+OMWt4o7Nb9U2ZxdGHpE3Zz/4l hiAj5zdUPuIMnLyVyXPqVGkt6OP6jBSFicwXuA14bP7rG4lfJMbaChaEesuz7VsNOv04 GLteaUDADm4XVhegWGywgIrHRLxQJmN+Iz3p729u32o5F94U4Wxd5XHnG4mYbnP62IW/ ac9btqWprs3hm1kIsiLu+6R/1QlZFJzLb5IvIyyxecZD41AuxG60ldzGjw1o89eHOtFo oU8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790027284; x=1790632084; h=in-reply-to:references:content-transfer-encoding:mime-version:to :from:cc:subject:message-id:date:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=z5JZc1dgLTzyazP060WQUuTKDJF15yUQFc5pQ6A1fqY=; b=mwTaIBYQNWJRYxrEbYYlSTFg+yvgCq6BjDT+D8ScH9zxA7SmuYGLXtF+TwmS/oDXSy W9hOUeKqfRxy+CXGg0sC9SlvGeaw7VN7pYvWqc7Q8r6+Sxaox6T0I3JnGtZQjzHShy/v FkRUmLVxaQVLgNUi12cXzoztvB0PvMpLi6dQdAv6hgsxsaDchOR6B36lWpC/Yu0UWscw 2xgd+ETBqZoZYYwyy+fV1HRtqcZy/snap9DyO/So3f3HhpnUzxxvECVDeGCVGxfmjlTx n7xzvLfO/Ap8L1c4qjiPxXLKDUEC05WRfLMS3xO43QKIKBgcxpZJssJvPTDDynYrKfOo q4Jg== X-Forwarded-Encrypted: i=1; AKwUvBxyAzDrLmfXHaSVBAiwoQO2DSbguMPNIM4p1foII7rvT/MGGwGQ7nxotjsz9SEfBLG0EvWcHvTkXW3BWpM1@postgresql.org X-Gm-Message-State: AFuF++nOa8P1ygQ0eS+Yeb1wAjbO8dfhCgjdOSOKg458vVmXYFBVDOxV QjQYYXiurHnfh3m4uiei/UDl0N3WelIbW0XryoKxtbur7t8+SXoLbE0a X-Gm-Gg: AYBFou3UyGMNOru4JGnckM++WR1KCFPkOY6cRNt4o6r47OBcKVcT2He4ppKlR2Aj8U6 mfsW0V9AH8g3bnEcGUl79eZDKen+J+hKPPR3cmrPJXiEQEqSx2PyxWH1o8eVRM/kSIfW4TnWq29 e0DA6tZ2r002pE+pI/sXOWlTG3tWXVb36aG0jmztOSLA4tarerdL5RYHMz6ZXr686FYYhtM0nK9 G3+G9sY8OrIyPa2yOCxbC8kqEXxGgJtrtZxb9onh3PLFe7zSgLQBrv5WjA/BvU9mR6dApt0VFn6 jAvDgkRWU7gyQ2rZgGWSifLYTGBeAA6nP436QB+BAjTW6L90aLrBpVRt2+vaD3jTrn1wdmEL5Rm E60c7TdUpRIVNzJxs9W4Jul5t+dpTfBKEGGesShHRaz0fHkLn3oIHlvB2t5ybjPC66X0HtWs8mr koKsJL4LzFlyTrKin+SX7qBwm3vW9DDGhcyXNauFrSOYYWmKiiNf8kTRdFoRUDIrtX3XJv+csTw LJ1JHTUUYTExNnAag== X-Received: by 2002:a05:600c:8b76:b0:49c:fa21:e749 with SMTP id 5b1f17b1804b1-49fc5757e86mr183676715e9.31.1790027284080; Mon, 21 Sep 2026 14:48:04 -0700 (PDT) Received: from localhost ([2a02:169:191:0:5102:af50:968a:9c93]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fd8a638fcsm23040435e9.0.2026.09.21.14.48.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Sep 2026 14:48:03 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Date: Mon, 21 Sep 2026 23:48:03 +0200 Message-Id: Subject: Re: Adding a stored generated column without long-lived locks Cc: =?utf-8?q?=C3=81lvaro_Herrera?= From: "Alberto Piai" To: "Alberto Piai" , "Laurenz Albe" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0 References: <6f5ea02f6e5205a96a9b3979190a4d7cb3c99414.camel@cybertec.at> <86a9336dc25d9a085916ad247a5791dc53d2ab13.camel@cybertec.at> <57bd5c0e2b532c07a1e6cd867520e899b1007622.camel@cybertec.at> <31fec16020bdf25d4a62cbbb4b8ea00af007e0d9.camel@cybertec.at> <82554bb40f6822bebbda7fcbc5ec1dc6a1823c0d.camel@cybertec.at> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all, in an attempt to avoid wasting committer time, I decided to use an LLM-based tool to analyze this patch and try to come up with counterexamples to break my usage of IS NOT DISTINCT FROM. It produced an example showing how IS NOT DISTINCT FROM isn't good enough either for my purpose. The problem is types where some values are evaluated as equal (according to =3D), but don't have the same representation. In conjuction with a unique index, they could be used to put a database in an invalid state where rewriting operations (update ... set a =3D a or pg_dump/pg_restore) fail. Repro: create table tgen.t_repro_1 (a numeric, b numeric); insert into tgen.t_repro_1 values ('1.0', '1.00'), ('1.0', '1.0'); create unique index on tgen.t_repro_1 ((b::text)); alter table tgen.t_repro_1 add constraint chk_gen check (b is not distinct from a); alter table tgen.t_repro_1 alter b add generated using constraint chk_gen stored; update tgen.t_repro_1 set a =3D a; ERROR: duplicate key value violates unique constraint "t_repro_1_b_idx" DETAIL: Key ((b::text))=3D(1.0) already exists. I will have to re-think this quite a bit. In general it's clear that I need to use an operator which proves that the value is identical bit by bit to what evaluating the expression would produce. The question will be how to make this accessible and usable enough, and at which cost in complexity. I won't have time to work on this for at least a few days, so in the meantime I will remove the "ready for committer" tag to avoid luring anyone into looking at this (at least with the committer hat on). Any feedback | thought | idea would of course be very welcome! :) Kind regards, Alberto --=20 Alberto Piai Sensational AG Z=C3=BCrich, Switzerland