Allow logical replication to transfer data in binary format.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Jul 2020 16:44:51 +0000 (12:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Jul 2020 16:44:51 +0000 (12:44 -0400)
commit9de77b5453130242654ff0b30a551c9c862ed661
tree9c48ed25ee4711934006078939a834186c8e9727
parent9add405014f8e47e038af7124528b7601249a2ac
Allow logical replication to transfer data in binary format.

This patch adds a "binary" option to CREATE/ALTER SUBSCRIPTION.
When that's set, the publisher will send data using the data type's
typsend function if any, rather than typoutput.  This is generally
faster, if slightly less robust.

As committed, we won't try to transfer user-defined array or composite
types in binary, for fear that type OIDs won't match at the subscriber.
This might be changed later, but it seems like fit material for a
follow-on patch.

Dave Cramer, reviewed by Daniel Gustafsson, Petr Jelinek, and others;
adjusted some by me

Discussion: https://postgr.es/m/CADK3HH+R3xMn=8t3Ct+uD+qJ1KD=Hbif5NFMJ+d5DkoCzp6Vgw@mail.gmail.com
21 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/alter_subscription.sgml
doc/src/sgml/ref/create_subscription.sgml
src/backend/catalog/pg_subscription.c
src/backend/catalog/system_views.sql
src/backend/commands/subscriptioncmds.c
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
src/backend/replication/logical/proto.c
src/backend/replication/logical/worker.c
src/backend/replication/pgoutput/pgoutput.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/psql/describe.c
src/include/catalog/catversion.h
src/include/catalog/pg_subscription.h
src/include/replication/logicalproto.h
src/include/replication/pgoutput.h
src/include/replication/walreceiver.h
src/test/regress/expected/subscription.out
src/test/regress/sql/subscription.sql
src/test/subscription/t/014_binary.pl [new file with mode: 0644]