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 1ruAFz-0034xH-I8 for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 12:07:20 +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 1ruAFy-0046wD-Kv for pgsql-general@arkaria.postgresql.org; Tue, 09 Apr 2024 12:07:18 +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 1ruAFy-0046w4-8f for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 12:07:18 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ruAFv-0000yv-F4 for pgsql-general@lists.postgresql.org; Tue, 09 Apr 2024 12:07:17 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a51b5633c9cso400417566b.2 for ; Tue, 09 Apr 2024 05:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712664434; x=1713269234; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9Dm3yzUPCc2Zh5FNJwYyrIwx7TLmG6ooGodS2udnIOk=; b=MSmCXqh5O4AHWFqxss/9Bfadb2P+0rQ3FUDSAi1mSTJxzOVdL0wsyViAKPhE7jlfgl CUB95Skt1vQrEIIrWI79GKOEMphFuWYGMFIthuNRv1hPliZeNsLoRWRXCDt4lGZw5Ph+ gSgsXofJ+5Jgu23am/up6EQYL92k7JNOiJZtYlMLUKGVZgZHwpNbrfPzKjlyU04Z6ks1 oVNpP8ywEsguR1yhOol5sG8ppjYlEgzlxAdnIYuNp44pmO4kw4cYLF8ffOzHqM9FnJDm QJvY4gVy9Vltuu8B6vTOYafmwRc27S8Cnf55eU4ho9DstpETp65JBl1XTg8H9PSA+Cx/ V0Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712664434; x=1713269234; h=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=9Dm3yzUPCc2Zh5FNJwYyrIwx7TLmG6ooGodS2udnIOk=; b=p1FFsY3QSELhoeTWnWH3SAQMpnpwulOrc4pWXcLy9ddR1HdB0KzyE7mIasohs/3Om7 MSFwFyXls7q4eNIfWcxWQAbpX/EW9+5sDT2cRucDzlLFXk3L7KMVgKomnYkGVB+tP6R6 Ei5GQpHP1L+Y7dZhKvCDPDxeHqPzJ/4wExybmJQPowiWsCePwKZglN5sT/D6jcSu0hsK TsLgiT71rEU0KzVfXbMERC7DGSM5BzLwM87xT3u/yGrCdunORIQVici80ckPOUEmHNhY 226Hj2ok9/az8BtTXG2AvXksvqIj0TW8dzJSZRYOuji7WyuGqNDW+BZDYKUJyFErvbQQ YgXw== X-Gm-Message-State: AOJu0Yxg0SHUJEyJFKfiJJQRBJjDEpb0T9sz5eQFPMLKbjJX+aYsrGWH 0on3LsTYDiqf7AeDu4gLLnUU1jVVoXhKweD9cARwfzIqhpU0Zhz/T89b09CWo8tw9OE5RlpqLlR RH2cs1+1Ic/FZBAhp15n2BwgD0Fk= X-Google-Smtp-Source: AGHT+IGUhuIk16TvI9fumXKiQmSJ4RLnITtrXbw8tvVsZ+8VExW/CYAgFoaf6BY+r9vv57F3uHE6ce628KkcmPyuPa8= X-Received: by 2002:a17:906:7c54:b0:a51:962d:e06b with SMTP id g20-20020a1709067c5400b00a51962de06bmr7706576ejp.55.1712664434149; Tue, 09 Apr 2024 05:07:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arvind Raghuwanshi Date: Tue, 9 Apr 2024 17:37:01 +0530 Message-ID: Subject: Re: Regarding: Replication of TRUNCATE commands is not working To: Laurenz Albe Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="00000000000037950f0615a8c395" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000037950f0615a8c395 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Laurenz, Thanks for the response Question: What PostgreSQL version are you using? The feature was introduced in v11. Answer: I am using the 16.0 Postgresql version. db1=3D> SELECT version(); version ---------------------------------------------------------------------------= -------------------------- PostgreSQL 16.0 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit (1 row) Question: How exactly is the publication defined? Perhaps TRUNCATE is excluded. I am not using the subscribe/publication model . but i have created a replication slot on the source database and then i am calling below procedure to get the details from replication slot: select data from pg_logical_slot_peek_changes('db1_slot', NULL, NULL, 'pretty-print', '1'); In the case of TRUNCATE , the above procedure does not show up any records. however this procedure shows up insert, update and delete events. As you mentioned TRUNCATE is excluded, is there any way to exclude TRUNCATE ? Thanks Arvind On Tue, Apr 9, 2024 at 4:08=E2=80=AFPM Laurenz Albe wrote: > On Tue, 2024-04-09 at 14:50 +0530, Arvind Raghuwanshi wrote: > > I have tried to run the TRUNCATE command and found out that it's not > getting replicated using logical replication for pgsql. > > I have also checked the schema change using pg_dump command but the > schema change also not getting detected for TRUNCATE command. > > > > However on pgsql logical replication doc page[1] , it's mentioned > that Replication of TRUNCATE commands is supported. > > > > [1] PostgreSQL: Documentation: 16: 31.6. Restrictions > > > > Any idea how we can solve this? > > What PostgreSQL version are you using? The feature was introduced in v11= . > How exactly is the publication defined? Perhaps TRUNCATE is excluded. > > Yours, > Laurenz Albe > --00000000000037950f0615a8c395 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Laurenz,
Thanks for the response
Question: What PostgreSQL version are you using?=C2=A0 = The feature was introduced in v11.
Answer: I am using the 16.0 Post= gresql version.
db1=3D> SELECT version();
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0version
----------------------------------------= -------------------------------------------------------------
=C2= =A0PostgreSQL 16.0 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3u= buntu1~18.04) 7.5.0, 64-bit
(1 row)

Question: How exactly is the publication defined?=C2=A0 Perhaps TRUNCATE = is excluded.
I am not using the subscribe/publication model . but= i have created a replication slot on the source database and then i am cal= ling below procedure to get the details from replication slot:
se= lect data from pg_logical_slot_peek_changes('db1_slot', NULL, NULL,= 'pretty-print', '1');

In the = case of TRUNCATE , the above procedure does not show up any records. howeve= r this procedure shows up insert, update and delete events.

<= /div>
As you mentioned TRUNCATE is excluded, is there any way to exclud= e TRUNCATE=C2=A0?

Thanks
Arvind

On Tue, Apr 9, 2024 at 4:08=E2=80=AFPM Laurenz A= lbe <laurenz.albe@cybertec.a= t> wrote:
On Tue, 2024-04-09 at 14:50 +0530, Arvind Raghuwanshi wrote:
> I have tried to run the TRUNCATE command=C2=A0 and found out that it&#= 39;s not getting replicated using logical replication for pgsql.
> I have also checked the schema change using pg_dump command but the sc= hema change also not getting detected for TRUNCATE command.
>
> However on pgsql logical replication doc page[1] , it's mentioned = that=C2=A0Replication of TRUNCATE commands is supported.
>
> [1]=C2=A0PostgreSQL: Documentation: 16: 31.6.=C2=A0Restrictions
>
> Any idea how we can solve=C2=A0this?

What PostgreSQL version are you using?=C2=A0 The feature was introduced in = v11.
How exactly is the publication defined?=C2=A0 Perhaps TRUNCATE is excluded.=

Yours,
Laurenz Albe
--00000000000037950f0615a8c395--