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 1tlapw-000PM0-SZ for pgsql-general@arkaria.postgresql.org; Fri, 21 Feb 2025 21:45:33 +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 1tlapw-00Gyl1-3n for pgsql-general@arkaria.postgresql.org; Fri, 21 Feb 2025 21:45:32 +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 1tlapv-00GyUs-Jw for pgsql-general@lists.postgresql.org; Fri, 21 Feb 2025 21:45:31 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tlaps-0001zC-2D for pgsql-general@lists.postgresql.org; Fri, 21 Feb 2025 21:45:30 +0000 Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-3ce87d31480so7984605ab.2 for ; Fri, 21 Feb 2025 13:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740174328; x=1740779128; 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=ISnziCVg8drGC80iWIG5PD9J4/O9m+cl1F+Fdbr7iAU=; b=Pej7OlFqJSu928oVyj5mEVgdwC1IL4UtcZPRjgdm52ci/3nyWPPNyc/vGGBLl1H1jO d0S5h7unXbTqSYrQ41FIt+/JpnhpQPssHk+NEdQXbSuv+IDK+kv/18e/Ma8B74YDBL6C QwwJ4AJpjBd2R9sPeuysKMye7GA0OxfwHnKrPykwpBEdRE/25TUaM2P76Xtw3B53yF8j RK6ht2lXT3I/8aTjF2ekELk8Xjkbks00e718UocrOJB9votx2tLavqdYSvjHCUfMRwsE rs4FJE9lyTFM3Q9PK7yoyhVtFFmbcIqbA6dW3ogSVnkbL4CUA6V4XQ7OilaeFjKmKKjs OSOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740174328; x=1740779128; 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=ISnziCVg8drGC80iWIG5PD9J4/O9m+cl1F+Fdbr7iAU=; b=eIV1pnePhkRtQ9GRd+0b8fKDdlXAdqscoPleRMhvbNVPYep/CpQn9RJbWa8tfPvR0g 2NC21eUAwKQRFkST3dP9LRhX1mwmnRFvW+/O+b6SZHSo7LlVfrh/Ced6yDuTd2qccJxu yJzY43cW/vV3Rsyob7jYvOAA5u5brojrxI4uzoqMqZI3H+A3XlAXQuBZHzcRzXGSgSFn u6T2y7Mz60dlYcDXOaZtQvE0P7+CO2thJ2+hxjldYxottQGB92A+pXYhApeZwk80KSKw pPEALOHn4hcEfBd54Wldd7moP9YQP8884WcW9KpQd+3BYq/G18dLGA/JIzXz/gue8ibS GVqg== X-Gm-Message-State: AOJu0YxWB3+amJmd3EWWoKef0OyPMFRRo28sghy4Okd9UjXqOXwXSWPo MEU4SV3uD3MJ9RI9sCNCUohtcJ8sLmwyadTeTU7YsiQaoXDNAb2VQi00DRZLyApOZXYwJpN1Ol/ sRcR0O/xlyj0Buc3ibj14WlOBpRoE/12t X-Gm-Gg: ASbGnctDAg/x63pEcDSmnA+sphWlI0rEQTIp9c0Bm9c3vIszceeu6Swi8w1iU6aIG5m 9PMFVmYDTxOvCK5tHJ2gyoVOLxqheqqjCelJyjKe/Sm6Se7NkMsDE71XRP0ilg2s3dgO14YefM6 RIS8vzX0U= X-Google-Smtp-Source: AGHT+IHThoOPOA4AQPbnCBG4A0dJk2VL6JN6c4kgEl3gKAeaXF5PcliGT8TXuoEmePXDhVlONYCFhpRGBU6V+l/461w= X-Received: by 2002:a92:c24d:0:b0:3d2:b2d0:f835 with SMTP id e9e14a558f8ab-3d2cae4f048mr57420865ab.2.1740174328303; Fri, 21 Feb 2025 13:45:28 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Justin Date: Fri, 21 Feb 2025 16:45:16 -0500 X-Gm-Features: AWEUYZlMfx-bm8agKegVHSH_Dv1oA-mCajJHBAQrRh1ie6L2VNudVn70vMAU2Qc Message-ID: Subject: Re: Logical decoding To: Jethish Jethish Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000af9c47062eade8b3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000af9c47062eade8b3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 20, 2025 at 12:04=E2=80=AFAM Jethish Jethish wrote: > Hi everyone, > > Is there is any option to perform logical decoding on an active > replication slot. > I'm trying to decode a replication slot but it throughs an error as below= . > > ERROR: replication slot "my_sub" is active for PID 2525720 > Hi Jethish, You can by copying the LR slot SELECT pg_copy_logical_replication_slot ( '', --source slot 'peek', --destination slot name true, --lets make a temporary slot, so we don't have clean up after ourselves 'test_decoding' --plugin name can be any LR plugin this one let's us see what is going on ) Then peek at what the slot is doing SELECT * FROM pg_logical_slot_peek_changes('peek' , --name of the slot NULL, --lsn number to start from can jump ahead, 1 ); --how many transaction to get back from the query this will return multiple rows for each row affect by the transaction. select pg_drop_replication_slot() --how we drop the slot --000000000000af9c47062eade8b3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Thu, Feb 20, 202= 5 at 12:04=E2=80=AFAM Jethish Jethish <jethish777@gmail.com> wrote:
Hi everyone,
=
Is there is any option to perform logical decod= ing on an active replication slot.
I'm trying to= decode a replication slot but it throughs an error as below.

ERROR: replication slot "my_sub&= quot; is active for PID 2525720


Hi Jethish,

You can by copying=C2=A0the LR slot=C2=A0
=
SELECT =C2=A0pg_copy_logical_replication_slot ( '<slot_name>&= #39;, --source slot
'peek', --destination slot name true, =C2=A0--lets make a temporary slot, so we don't have c= lean up after ourselves=C2=A0
'test_decoding' --plugin= name can be any LR plugin=C2=A0this one let's us see what is going on<= br>)

Then peek at what the slot is doing

SELECT * FROM pg_log= ical_slot_peek_changes('peek' , --name of the slot
N= ULL, --lsn number to start from =C2=A0can jump ahead,
1 ); --= how many transaction to get back from the query this will return multiple r= ows for each row affect by the transaction.=C2=A0

select pg_drop_rep= lication_slot(<slot_name>)=C2=A0 --how we drop the slot
=C2= =A0
--000000000000af9c47062eade8b3--