@@ -123,7 +123,7 @@ isBabelfishDatabase(PGconn *conn)
123123 * or not.
124124 */
125125void
126- dumpBabelRestoreChecks (FILE * OPF , PGconn * conn , int binary_upgrade )
126+ dumpBabelRestoreChecks (FILE * OPF , PGconn * conn , int binary_upgrade , char * restrict_key )
127127{
128128 PGresult * res ;
129129 int source_server_version_num ;
@@ -151,7 +151,9 @@ dumpBabelRestoreChecks(FILE *OPF, PGconn *conn, int binary_upgrade)
151151 * Temporarily enable ON_ERROR_STOP so that whole restore script
152152 * execution fails if the following do block raises an error.
153153 */
154+ appendPQExpBuffer (qry , "\\unrestrict %s\n" , restrict_key );
154155 appendPQExpBufferStr (qry , "\\set ON_ERROR_STOP on\n\n" );
156+ appendPQExpBuffer (qry , "\\restrict %s\n" , restrict_key );
155157 appendPQExpBuffer (qry ,
156158 "DO $$"
157159 "\nDECLARE"
@@ -187,7 +189,10 @@ dumpBabelRestoreChecks(FILE *OPF, PGconn *conn, int binary_upgrade)
187189 "\n END IF;"
188190 "\nEND$$;\n\n"
189191 , source_migration_mode );
192+
193+ appendPQExpBuffer (qry , "\\unrestrict %s\n" , restrict_key );
190194 appendPQExpBufferStr (qry , "\\set ON_ERROR_STOP off\n" );
195+ appendPQExpBuffer (qry , "\\restrict %s\n" , restrict_key );
191196 PQclear (res );
192197
193198 fprintf (OPF , "%s" , qry -> data );
0 commit comments