43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
create schema v;
|
|
create table v.foo(
|
|
id int primary key
|
|
);
|
|
select
|
|
1
|
|
from
|
|
pg_create_logical_replication_slot('reg_test', 'wal2json', false);
|
|
?column?
|
|
----------
|
|
1
|
|
(1 row)
|
|
|
|
insert into v.foo(id) values (1);
|
|
select
|
|
data
|
|
from
|
|
pg_logical_slot_get_changes(
|
|
'reg_test',
|
|
null,
|
|
null,
|
|
'include-pk', '1',
|
|
'include-transaction', 'false',
|
|
'include-timestamp', 'false',
|
|
'include-type-oids', 'false',
|
|
'format-version', '2',
|
|
'actions', 'insert,update,delete'
|
|
) x;
|
|
data
|
|
--------------------------------------------------------------------------------------------------------------------------------------
|
|
{"action":"I","schema":"v","table":"foo","columns":[{"name":"id","type":"integer","value":1}],"pk":[{"name":"id","type":"integer"}]}
|
|
(1 row)
|
|
|
|
select
|
|
pg_drop_replication_slot('reg_test');
|
|
pg_drop_replication_slot
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
drop schema v cascade;
|
|
NOTICE: drop cascades to table v.foo
|