作者
digoal
日期
2020-03-26
标签
PostgreSQL , pg-deltaflood , 逻辑订阅
背景
stream changes to a PostgreSQL database in an easily parsed format for mirroring to a third party application or database
https://github.com/flightaware/pg-deltaflood
USING
pg_recvlogical --create-slot --slot streamer --plugin=deltaflood
pg_recvlogical --start --slot streamer --file=- -o opt=value...
Options:
-
include-xids=bool default true
include _xid (Transaction ID) pseudo-column
-
include-oids=bool default true
include _oid (object ID) pseudo_column
-
include-lsn=bool default false
include _lsn (Logical Serial Number) pseudo_column
-
full-name=bool default false
use fully qualified table name with schema
-
skip-nulls=bool default true
Don't even output columns with null values
-
escape_chars=bool default true
escape tab as \t, newline as \n, other control characters as \NNN in octal
-
convert-bool=bool default true
convert boolean values to "1" or "0" regardless of original representation
-
null=null_string default NULL
if skip-nulls=false, then use this as the null string
-
separator=tab default \t
separate columns with this string
-
tables=table,table,table default all tables
Only output rows for listed tables
Output example
$ pg_recvlogical --start --slot streamer --file=- -o tables=bar,baz -o include-oids
_table bar _xid 579 _action insert a cat b meow
_table bar _xid 581 _action insert a cat b meow
_table baz _xid 582 _action insert _oid 16405 a rocket b science
_table baz _xid 584 _action insert _oid 16406 a rocket b science
^C
$ pg_recvlogical --start --slot streamer --file=- -o include-lsn
_table zzz _xid 7619 _lsn 0/177B148 _action insert a able b a
_table zzz _xid 7620 _lsn 0/177B148 _action delete a able
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.