public inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin <[email protected]>
To: Jethish Jethish <[email protected]>
Cc: [email protected]
Subject: Re: Logical decoding
Date: Fri, 21 Feb 2025 16:45:16 -0500
Message-ID: <CALL-XeN2qJRByqywoJ5YKVBxVoboNmPGRp9uYQEWZU4U1wmTdw@mail.gmail.com> (raw)
In-Reply-To: <CAKeSjMjBTxSVHq==8UuNBwAXjDC+vonsdJEd3TndN2-PP=NzpQ@mail.gmail.com>
References: <CAKeSjMjBTxSVHq==8UuNBwAXjDC+vonsdJEd3TndN2-PP=NzpQ@mail.gmail.com>

On Thu, Feb 20, 2025 at 12:04 AM Jethish Jethish <[email protected]>
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 ( '<slot_name>', --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(<slot_name>)  --how we drop the slot


view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Logical decoding
  In-Reply-To: <CALL-XeN2qJRByqywoJ5YKVBxVoboNmPGRp9uYQEWZU4U1wmTdw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox