admin管理员组文章数量:1405125
Code
do $$BEGIN
perform pg_create_logical_replication_slot('test', 'pgoutput', false);
END$$ ;
create publication Jalgi_pub for all tables;
select * from pg_logical_slot_peek_binary_changes('test', null, null,'proto_version', '4', 'publication_names', 'Jalgi_pub' )
returns replication commands as binary content in Data column. How to convert this data to sql commands like insert, update, delete ?
Using C#, npgsql, ef core and ASP.NET MVC. Can some npgsql method uses for this? Or is it possible to create replication which returns this data as replication messages? Or can binry replcaton used
Code
do $$BEGIN
perform pg_create_logical_replication_slot('test', 'pgoutput', false);
END$$ ;
create publication Jalgi_pub for all tables;
select * from pg_logical_slot_peek_binary_changes('test', null, null,'proto_version', '4', 'publication_names', 'Jalgi_pub' )
returns replication commands as binary content in Data column. How to convert this data to sql commands like insert, update, delete ?
Using C#, npgsql, ef core and ASP.NET MVC. Can some npgsql method uses for this? Or is it possible to create replication which returns this data as replication messages? Or can binry replcaton used
Share Improve this question asked Mar 22 at 20:53 AndrusAndrus 28k67 gold badges215 silver badges396 bronze badges1 Answer
Reset to default 0You have to use plugins which does the task of converting wal events to sql queries.One such plugin is decoder_raw
https://github/michaelpq/pg_plugins/blob/main/decoder_raw/decoder_raw.c
Install it and create slot with this plugin.
本文标签: postgresqlHow to parse logical replication commandsStack Overflow
版权声明:本文标题:postgresql - How to parse logical replication commands - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744303801a2599711.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论