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 1tNrcr-002eQQ-Ed for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Dec 2024 10:49:57 +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 1tNrcq-00DXLa-Ew for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Dec 2024 10:49:56 +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.94.2) (envelope-from ) id 1tNrcq-00DXLS-5R for pgsql-hackers@lists.postgresql.org; Wed, 18 Dec 2024 10:49:55 +0000 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tNrcn-000BcO-AR for pgsql-hackers@postgresql.org; Wed, 18 Dec 2024 10:49:54 +0000 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-5f31f8f4062so2614615eaf.3 for ; Wed, 18 Dec 2024 02:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734518992; x=1735123792; 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=F5I5iu4hnxA39ec7s0IviqFSfVD6VEEbRkVOr42bmMs=; b=QW8rdKEw8JHKCM/jGJUv5TMnO9kma/vD22iMoWv+u9KCelN/Y30j4XV4CLNlq+T2/X hAVeMAxXJSmJk5xsTU34rx/C1gCbEc5jgY9Td5CcB4x6uyCGfiQonoIk4nyO+DMux+MD so+5CZBlBX4Sczd4gxZtNlDMjNGPLp34LI9GSofX9jehG8u8s1W7zvJbTTmiXIWtAaYH fT2r65td3fzMoY1eELA30sRnn5Z6Pv19+Q3tuNMy+/+Vx5BF93XRQeQNQk3mxWi6lNmb iXf7pTzqgnFTRK+j7+U//jVOjnzgXXZyTKGXgJ1UtEwGvPmB1k5NNz4HMvGLHwbZCC3Z /g+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734518992; x=1735123792; 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=F5I5iu4hnxA39ec7s0IviqFSfVD6VEEbRkVOr42bmMs=; b=HEs/T57+9su38haWrM3O/am6/13RNTJSieXOAje4h6NRZyN3XeND/fCphF57qYoSDH k2eUmRm3daWZmwE4Vxi/BOYgHWmQPgbf4V9K7+0zzvhbcht0v4wrfiWC4bOl9mPFsDPQ JcX65aUq/A8mGKVwBTCH+xo8EYqqxWR6r2+ZtuznEr55YicxM8RE3rA6CUXvj8QdqaVZ kvKb8MYcN+GzzPKDFbPuA8BginwL4iaYPRdGjrg+Hk5UC9SDTCKWvlgK8fcpKoVFUKpD PnFdHrCz4tt5uqU7NMDzrHMAoyvzM5u3KF8gLX+ILLKFEaJnXE0cZzcpURLz+rc8EQpu c0Og== X-Forwarded-Encrypted: i=1; AJvYcCW8PqjJC9I9rKIbbZfVgLzSQJtDRrSiPTFEtpvlWLH2ya2Dpb/fMqhfy70hPmy4kPN3t1CLQVfSXpy6myzf@postgresql.org X-Gm-Message-State: AOJu0YxknO5/TDq2O34xms/ozQb9f50E5HJZhtIXqEv1Yer5pXsOVOpP NWbBrZetXtKvRqR567zcsEPFhDpqxLBmkEoPfL6hWv7qFpPh3iCaiqFzp5Vey/xQeuSPNL4ckb2 FwKnK+WJDk8Uae64ixw6/PAIEaq8= X-Gm-Gg: ASbGncu5ONbsaUgYck2V0AvVrFgnakSTuEKxHjWy5gvG5vfi/dVXn7TBSgpXN/GDyuf 48MoP6jlEUn+70E/0DUMg4I7Wa0UofbyWsYT2iCy8 X-Google-Smtp-Source: AGHT+IHs9koWKvdCfWQP20KpLxdfo+PFMG+2hglzHYr/rNPNVoXXUSmWMPFFJutvNBinlZYrFSiIsV9pcie71yTBo8c= X-Received: by 2002:a05:6870:702a:b0:297:1d2a:a718 with SMTP id 586e51a60fabf-2a7b3190b5dmr1243161fac.21.1734518992262; Wed, 18 Dec 2024 02:49:52 -0800 (PST) MIME-Version: 1.0 References: <8f31307e0de000a103a9713e19db5ec07354ffb3.camel@cybertec.at> <222e84b3f258d5487de5b5a0f1119e00b84071bc.camel@cybertec.at> In-Reply-To: From: Amit Kapila Date: Wed, 18 Dec 2024 16:19:40 +0530 Message-ID: Subject: Re: Question about behavior of deletes with REPLICA IDENTITY NOTHING To: James Coleman Cc: Ashutosh Bapat , Laurenz Albe , Peter Smith , pgsql-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 On Thu, Feb 8, 2024 at 7:24=E2=80=AFPM James Coleman wro= te: > > On Thu, Feb 8, 2024 at 4:47=E2=80=AFAM Ashutosh Bapat > wrote: > > > > On Thu, Feb 8, 2024 at 9:57=E2=80=AFAM Laurenz Albe wrote: > > > > > > On Thu, 2024-02-08 at 13:40 +1100, Peter Smith wrote: > > > > - how to set the replica identity. If a table without a replica = identity is > > > > + how to set the replica identity. If a table without a replica = identity > > > > + (or with replica identity behavior the same as NOTHING= ) is > > > > added to a publication that replicates UPDATE > > > > or DELETE operations then > > > > subsequent UPDATE or DELETE > > > > > > I had the impression that the root of the confusion was the perceived= difference > > > between "REPLICA IDENTITY NOTHING" and "no replica identity", and tha= t change > > > doesn't improve that. > > > > > > How about: > > > > > > If a table without a replica identity (explicitly set to N= OTHING, > > > or set to a primary key or index that doesn't exist) is added ... > > > > Another possibility is just to improve the documentation of various > > options as follows. > > > > DEFAULT > > > > If there is a primary key, record the old values of the columns of the > > primary key. Otherwise it acts as NOTHING. This is the default for > > non-system tables. > > > > USING INDEX index_name > > > > Records the old values of the columns covered by the named index, that > > must be unique, not partial, not deferrable, and include only columns > > marked NOT NULL. If this index is dropped, the behavior is the same as > > NOTHING. > > > > FULL > > > > Records the old values of all columns in the row. > > > > NOTHING > > > > Records no information about the old row. This is equivalent to having > > no replica identity. This is the default for system tables. > > This is the simplest change, and it does solve the confusion, so I'd > be happy with it also. The other proposals have the benefit of having > all the information necessary on the publications page rather than > requiring the user to refer to the ALTER TABLE REPLICA IDENTITY page > to understand what's meant. > There is no harm in having it at both places (publications page and ALTER TABLE REPLICA IDENTITY page). Would someone be interested in preparing a patch with the changes agreed upon? --=20 With Regards, Amit Kapila.