48.1. Logical Decoding Examples

Started by PG Bug reporting formover 2 years ago4 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/logicaldecoding-example.html
Description:

At the beginning of this section, please change this statement:

Before you can use logical decoding, you must set wal_level to logical and
max_replication_slots to at least 1, and shared_preload_libraries to
'test_decoding'.

#2Euler Taveira
euler@eulerto.com
In reply to: PG Bug reporting form (#1)
Re: 48.1. Logical Decoding Examples

On Sun, Oct 22, 2023, at 7:41 PM, PG Doc comments form wrote:

At the beginning of this section, please change this statement:

Before you can use logical decoding, you must set wal_level to logical and
max_replication_slots to at least 1, and shared_preload_libraries to
'test_decoding'.

There is no need to preload the output plugin. logical decoding will do it. The
documentation is correct (see LoadOputputPlugin() function).

--
Euler Taveira
EDB https://www.enterprisedb.com/

#3Kevin Wang
kevinpgcloud@gmail.com
In reply to: Euler Taveira (#2)
Re: 48.1. Logical Decoding Examples

In my testing environment, I did not specify "shared_preload_libraries" and
I cannot create the logical replication slot with the "test_decoding" type.
test_decoding is in contrib folder and is not build-in, so if you do not
specify it, you cannot create the replication slot.

On Mon, Oct 23, 2023 at 2:25 PM Euler Taveira <euler@eulerto.com> wrote:

Show quoted text

On Sun, Oct 22, 2023, at 7:41 PM, PG Doc comments form wrote:

At the beginning of this section, please change this statement:

Before you can use logical decoding, you must set wal_level to logical and
max_replication_slots to at least 1, and shared_preload_libraries to
'test_decoding'.

There is no need to preload the output plugin. logical decoding will do
it. The
documentation is correct (see LoadOputputPlugin() function).

--
Euler Taveira
EDB https://www.enterprisedb.com/

#4Euler Taveira
euler@eulerto.com
In reply to: Kevin Wang (#3)
Re: 48.1. Logical Decoding Examples

On Mon, Oct 23, 2023, at 3:44 PM, Kevin Wang wrote:

In my testing environment, I did not specify "shared_preload_libraries" and I cannot create the logical replication slot with the "test_decoding" type. test_decoding is in contrib folder and is not build-in, so if you do not specify it, you cannot create the replication slot.

You didn't provide enough information or provide the exact commands and
settings to show the failure.

$ psql -c "show wal_level" -d postgres
wal_level
-----------
logical
(1 row)

$ psql -c "show max_replication_slots" -d postgres
max_replication_slots
-----------------------
1
(1 row)

$ psql -c "show shared_preload_libraries" -d postgres
shared_preload_libraries
--------------------------

(1 row)

$ psql -c "SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding', false, true)" -d postgres
slot_name | lsn
-----------------+-----------
regression_slot | 0/6069338
(1 row)

$ psql -c "SELECT slot_name, plugin, slot_type, database, active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots" -d postgres
slot_name | plugin | slot_type | database | active | restart_lsn | confirmed_flush_lsn
-----------------+---------------+-----------+----------+--------+-------------+---------------------
regression_slot | test_decoding | logical | postgres | f | 0/6069300 | 0/6069338
(1 row)

$ psql -c "SELECT version()" -d postgres
version
---------------------------------------------------------------------------------------------------
PostgreSQL 16.0 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)

--
Euler Taveira
EDB https://www.enterprisedb.com/