@@ -55,11 +55,15 @@ static List *fetch_table_list(WalReceiverConn *wrconn, List *publications);
55
55
* accommodate that.
56
56
*/
57
57
static void
58
- parse_subscription_options (List * options , bool * connect , bool * enabled_given ,
59
- bool * enabled , bool * create_slot ,
58
+ parse_subscription_options (List * options ,
59
+ bool * connect ,
60
+ bool * enabled_given , bool * enabled ,
61
+ bool * create_slot ,
60
62
bool * slot_name_given , char * * slot_name ,
61
- bool * copy_data , char * * synchronous_commit ,
62
- bool * refresh )
63
+ bool * copy_data ,
64
+ char * * synchronous_commit ,
65
+ bool * refresh ,
66
+ bool * binary_given , bool * binary )
63
67
{
64
68
ListCell * lc ;
65
69
bool connect_given = false;
@@ -90,6 +94,11 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
90
94
* synchronous_commit = NULL ;
91
95
if (refresh )
92
96
* refresh = true;
97
+ if (binary )
98
+ {
99
+ * binary_given = false;
100
+ * binary = false;
101
+ }
93
102
94
103
/* Parse options */
95
104
foreach (lc , options )
@@ -175,6 +184,16 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
175
184
refresh_given = true;
176
185
* refresh = defGetBoolean (defel );
177
186
}
187
+ else if (strcmp (defel -> defname , "binary" ) == 0 && binary )
188
+ {
189
+ if (* binary_given )
190
+ ereport (ERROR ,
191
+ (errcode (ERRCODE_SYNTAX_ERROR ),
192
+ errmsg ("conflicting or redundant options" )));
193
+
194
+ * binary_given = true;
195
+ * binary = defGetBoolean (defel );
196
+ }
178
197
else
179
198
ereport (ERROR ,
180
199
(errcode (ERRCODE_SYNTAX_ERROR ),
@@ -322,6 +341,8 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
322
341
char * conninfo ;
323
342
char * slotname ;
324
343
bool slotname_given ;
344
+ bool binary ;
345
+ bool binary_given ;
325
346
char originname [NAMEDATALEN ];
326
347
bool create_slot ;
327
348
List * publications ;
@@ -331,10 +352,15 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
331
352
*
332
353
* Connection and publication should not be specified here.
333
354
*/
334
- parse_subscription_options (stmt -> options , & connect , & enabled_given ,
335
- & enabled , & create_slot , & slotname_given ,
336
- & slotname , & copy_data , & synchronous_commit ,
337
- NULL );
355
+ parse_subscription_options (stmt -> options ,
356
+ & connect ,
357
+ & enabled_given , & enabled ,
358
+ & create_slot ,
359
+ & slotname_given , & slotname ,
360
+ & copy_data ,
361
+ & synchronous_commit ,
362
+ NULL , /* no "refresh" */
363
+ & binary_given , & binary );
338
364
339
365
/*
340
366
* Since creating a replication slot is not transactional, rolling back
@@ -400,6 +426,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
400
426
DirectFunctionCall1 (namein , CStringGetDatum (stmt -> subname ));
401
427
values [Anum_pg_subscription_subowner - 1 ] = ObjectIdGetDatum (owner );
402
428
values [Anum_pg_subscription_subenabled - 1 ] = BoolGetDatum (enabled );
429
+ values [Anum_pg_subscription_subbinary - 1 ] = BoolGetDatum (binary );
403
430
values [Anum_pg_subscription_subconninfo - 1 ] =
404
431
CStringGetTextDatum (conninfo );
405
432
if (slotname )
@@ -669,10 +696,18 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
669
696
char * slotname ;
670
697
bool slotname_given ;
671
698
char * synchronous_commit ;
672
-
673
- parse_subscription_options (stmt -> options , NULL , NULL , NULL ,
674
- NULL , & slotname_given , & slotname ,
675
- NULL , & synchronous_commit , NULL );
699
+ bool binary_given ;
700
+ bool binary ;
701
+
702
+ parse_subscription_options (stmt -> options ,
703
+ NULL , /* no "connect" */
704
+ NULL , NULL , /* no "enabled" */
705
+ NULL , /* no "create_slot" */
706
+ & slotname_given , & slotname ,
707
+ NULL , /* no "copy_data" */
708
+ & synchronous_commit ,
709
+ NULL , /* no "refresh" */
710
+ & binary_given , & binary );
676
711
677
712
if (slotname_given )
678
713
{
@@ -697,6 +732,13 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
697
732
replaces [Anum_pg_subscription_subsynccommit - 1 ] = true;
698
733
}
699
734
735
+ if (binary_given )
736
+ {
737
+ values [Anum_pg_subscription_subbinary - 1 ] =
738
+ BoolGetDatum (binary );
739
+ replaces [Anum_pg_subscription_subbinary - 1 ] = true;
740
+ }
741
+
700
742
update_tuple = true;
701
743
break ;
702
744
}
@@ -706,9 +748,15 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
706
748
bool enabled ,
707
749
enabled_given ;
708
750
709
- parse_subscription_options (stmt -> options , NULL ,
710
- & enabled_given , & enabled , NULL ,
711
- NULL , NULL , NULL , NULL , NULL );
751
+ parse_subscription_options (stmt -> options ,
752
+ NULL , /* no "connect" */
753
+ & enabled_given , & enabled ,
754
+ NULL , /* no "create_slot" */
755
+ NULL , NULL , /* no "slot_name" */
756
+ NULL , /* no "copy_data" */
757
+ NULL , /* no "synchronous_commit" */
758
+ NULL , /* no "refresh" */
759
+ NULL , NULL ); /* no "binary" */
712
760
Assert (enabled_given );
713
761
714
762
if (!sub -> slotname && enabled )
@@ -744,9 +792,15 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
744
792
bool copy_data ;
745
793
bool refresh ;
746
794
747
- parse_subscription_options (stmt -> options , NULL , NULL , NULL ,
748
- NULL , NULL , NULL , & copy_data ,
749
- NULL , & refresh );
795
+ parse_subscription_options (stmt -> options ,
796
+ NULL , /* no "connect" */
797
+ NULL , NULL , /* no "enabled" */
798
+ NULL , /* no "create_slot" */
799
+ NULL , NULL , /* no "slot_name" */
800
+ & copy_data ,
801
+ NULL , /* no "synchronous_commit" */
802
+ & refresh ,
803
+ NULL , NULL ); /* no "binary" */
750
804
751
805
values [Anum_pg_subscription_subpublications - 1 ] =
752
806
publicationListToArray (stmt -> publication );
@@ -781,9 +835,15 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
781
835
(errcode (ERRCODE_SYNTAX_ERROR ),
782
836
errmsg ("ALTER SUBSCRIPTION ... REFRESH is not allowed for disabled subscriptions" )));
783
837
784
- parse_subscription_options (stmt -> options , NULL , NULL , NULL ,
785
- NULL , NULL , NULL , & copy_data ,
786
- NULL , NULL );
838
+ parse_subscription_options (stmt -> options ,
839
+ NULL , /* no "connect" */
840
+ NULL , NULL , /* no "enabled" */
841
+ NULL , /* no "create_slot" */
842
+ NULL , NULL , /* no "slot_name" */
843
+ & copy_data ,
844
+ NULL , /* no "synchronous_commit" */
845
+ NULL , /* no "refresh" */
846
+ NULL , NULL ); /* no "binary" */
787
847
788
848
AlterSubscription_refresh (sub , copy_data );
789
849
0 commit comments