56
56
57
57
#define CATALOG_LOCAL_SYNC_STATUS "local_sync_status"
58
58
59
+ #if PG_VERSION_NUM < 90500
60
+ #define PGDUMP_BINARY "pglogical_dump"
61
+ #else
62
+ #define PGDUMP_BINARY "pg_dump"
63
+ #endif
64
+ #define PGRESTORE_BINARY "pg_restore"
65
+
59
66
#define Natts_local_sync_state 5
60
67
#define Anum_sync_kind 1
61
68
#define Anum_sync_subid 2
@@ -77,7 +84,7 @@ dump_structure(PGLogicalSubscription *sub, const char *snapshot)
77
84
int res ;
78
85
StringInfoData command ;
79
86
80
- if (find_other_exec_version (my_exec_path , "pg_dump" , & version , pg_dump ))
87
+ if (find_other_exec_version (my_exec_path , PGDUMP_BINARY , & version , pg_dump ))
81
88
elog (ERROR , "pglogical subscriber init failed to find pg_dump relative to binary %s" ,
82
89
my_exec_path );
83
90
@@ -87,7 +94,11 @@ dump_structure(PGLogicalSubscription *sub, const char *snapshot)
87
94
PG_VERSION_NUM / 100 / 100 , PG_VERSION_NUM / 100 % 100 );
88
95
89
96
initStringInfo (& command );
97
+ #if PG_VERSION_NUM < 90500
98
+ appendStringInfo (& command , "%s --snapshot=\"%s\" -s -N %s -N pglogical_origin -F c -f \"/tmp/pglogical-%d.dump\" \"%s\"" ,
99
+ #else
90
100
appendStringInfo (& command , "%s --snapshot=\"%s\" -s -N %s -F c -f \"/tmp/pglogical-%d.dump\" \"%s\"" ,
101
+ #endif
91
102
pg_dump , snapshot , EXTENSION_NAME , MyProcPid ,
92
103
sub -> origin_if -> dsn );
93
104
@@ -108,7 +119,7 @@ restore_structure(PGLogicalSubscription *sub, const char *section)
108
119
int res ;
109
120
StringInfoData command ;
110
121
111
- if (find_other_exec_version (my_exec_path , "pg_restore" , & version , pg_restore ))
122
+ if (find_other_exec_version (my_exec_path , PGRESTORE_BINARY , & version , pg_restore ))
112
123
elog (ERROR , "pglogical subscriber init failed to find pg_restore relative to binary %s" ,
113
124
my_exec_path );
114
125
@@ -217,6 +228,7 @@ start_copy_target_tx(PGconn *conn)
217
228
PGresult * res ;
218
229
const char * setup_query =
219
230
"BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;\n"
231
+ "SET session_replication_role = 'replica';\n"
220
232
"SET DATESTYLE = ISO;\n"
221
233
"SET INTERVALSTYLE = POSTGRES;\n"
222
234
"SET extra_float_digits TO 3;\n"
0 commit comments