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.94.2) (envelope-from ) id 1urBwL-0022yC-U4 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2025 08:55:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1urBwL-00DdYk-77 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2025 08:55: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.94.2) (envelope-from ) id 1urBwK-00DdYb-Su for pgsql-hackers@lists.postgresql.org; Wed, 27 Aug 2025 08:55:33 +0000 Received: from mail-vk1-xa30.google.com ([2607:f8b0:4864:20::a30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1urBwI-0026zl-2D for pgsql-hackers@postgresql.org; Wed, 27 Aug 2025 08:55:32 +0000 Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-53b174ca9bdso4865230e0c.2 for ; Wed, 27 Aug 2025 01:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756284929; x=1756889729; 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=cEImtgOjIeXgwnbuQX8jC4u4iOYZO+uoFBvqSNdQbkQ=; b=ggy+dVmWeZFhRLUkuQQuM56mUMFgxOikSd4Ybth6mP/ZeR1RPBbeQ87Y+QDO9hovJ7 i2yQU6BbXJpVkX+E1AfUEWYIkPOfWmIunOwJc9m/sGHSZCj540fF1sNHDjNr1r74m05n Ot1tRjiTzh4Mo0mhKhrR0Nx6yOk3tejo/WGHdlggzxO1jCLT02aOe3ek4OVdT0buBOXc i7AAG2l4BB8fHYSB/C2RHxci+k82Cd7RMGXfdZy7+5ucG1CPfru5jfYYYFU1M22ZR6/G uF/+mUGxYw59DTumJ9i4b/WMYws+d8dse9UQMm/kF7rHkjp69mjORaRbS1es2mTFNht7 GoNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756284929; x=1756889729; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cEImtgOjIeXgwnbuQX8jC4u4iOYZO+uoFBvqSNdQbkQ=; b=iKIfu4F1H8sPqX6gtskbQqw1PtOclHxA27+CD++AbNWfhVe/xtuh7LbNkm7D3sGeX9 9iiQCmfAeAOOPw+jXryTsLiSTu5mOc/vqOQGUqe6md67tCR7OUkbPOyAep0Kg+3gxekL CvYGewLcQdxs09mxZGJEj47pR7vX3a/JGck+eSIDOjR9TCcWEgZpbY/eH3idYAXxZJmF gNpLEul4195QvQFJivTv1C5RdVkUoU7wBEy9XFDjjJM6gBKPmerjxmRvkU/SUkxDSNWu 8Ezay+SAuvis5UGXhUyT2NLIDuLygxdTgLZlZ/9IcZog+yCJciue89C+3z/X1c2Dx4Gu GOoQ== X-Forwarded-Encrypted: i=1; AJvYcCX2iJjt9YU2G31nh3tjtPSgTwyZrKCGpZV3icWGofWljwDfp9qYpeaBD93IXFIpOT1VgEa/nFHN2NLWIDE7@postgresql.org X-Gm-Message-State: AOJu0YzQ0KOT03Eh52ciYRMestvIZ7gR6KYBNKnLvwyZZxRonWoD+Ogb Dq7FXiG5Yqovx/p1jop4dqNxjsLZUHEMilV0VbRbi2dAR/IYdvgkDV3POPd2/QQyctqXvtQors9 mbQLFuKyW4oA8uoPXjAo8ZGnXQkYD/YU= X-Gm-Gg: ASbGnct/8MZKraxi6yCIZM1hXHp/KXrt+75BePlxXWXYB5DK0YSLUqWrsqLh6daTVyo tO/le07PgaAXRp1lUu0cScgPRjX2WIgdcD1WqrUzTWZGMGEj3p4357fJ4YSVF9qqMYCr4CZDxi+ MUwMiyenfE4zZOAPDFYTanff1gp6OIFKWQz6yG+SDKls3Yg9G2WaBlYI6FRv4a89qHxkOUfxn5L kmgj9HmKegGG3yXpg== X-Google-Smtp-Source: AGHT+IEq/dbr3rUhFViu2qqNgPBIyYH/+ZReIxf8QDnOAASFNsPVZ6M2LQv+et/xIBD1O3YeKg6UoamIoTR+yKJbBmk= X-Received: by 2002:a05:6122:2528:b0:539:4097:794a with SMTP id 71dfb90a1353d-53c8a3cad8emr6206788e0c.12.1756284929027; Wed, 27 Aug 2025 01:55:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mihail Nikalayeu Date: Wed, 27 Aug 2025 10:53:57 +0200 X-Gm-Features: Ac12FXx_QQejvC4NlYTKl85vat12QAjoKyvbJ7AR0zXrrZAzJGwr2vOZuYqxq74 Message-ID: Subject: Re: [BUG?] check_exclusion_or_unique_constraint false negative To: Amit Kapila Cc: "Zhijie Hou (Fujitsu)" , Peter Geoghegan , "Hayato Kuroda (Fujitsu)" , PostgreSQL Hackers , Andres Freund , peter@eisentraut.org 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 Hello, Amit! Amit Kapila : > Now, I > would like to know the opinion of others who were involved in the > initial commit, so added Peter E. to see what he thinks of the same. Seems like you added another Peter in [0] - I added Peter Eisentraut :) > > Hmm.... Yes - if the TID lands to the page left of the current > > position, we=E2=80=99ll miss it as well. > > A lock=E2=80=91based solution (version in the v10) would require keepin= g all > > pages with the same key under a read lock, which feels too expensive. > Right. I think it is possible to achieve the same guarantees and logic using GetLatestSnapshot + HeapTupleSatisfiesDirty, but without the "tuple not found" case - I'll try to experiment with it. GetLatestSnapshot is called before tuple lock anyway. > I think it is better to document this race somewhere in a logical > replication document for now unless we have a consensus on a way to > move forward. Yes, it is an option, but what documentation is going to be strange: * there is delete_missing type of conflict stats\logs, but be aware it may be wrong (actually it delete_missing) * the same for update_missing vs update_origin_differs * the same for update_deleted vs update_origin_differs * also DELETE or UPDATE from publisher may be missed in case of update on subscriber even if update touches subscriber-only columns It looks like "if something is updating on subscriber - no guarantees". And the worst thing - it is the actual state. [0]: https://www.postgresql.org/message-id/flat/CAA4eK1LZxzORgAoDhix9MWrOqY= OsNZuZLW2sTfGsJFM99yRgrg%40mail.gmail.com#02be86f7e2d24a038878f03ac1b93e95 Best regards, MIkhail.