@@ -89,6 +89,7 @@ static char *target_name = NULL;
8989static char * target_action = NULL ;
9090
9191static pgRecoveryTarget * recovery_target_options = NULL ;
92+ static pgRestoreParams * restore_params = NULL ;
9293
9394bool restore_as_replica = false;
9495bool no_validate = false;
@@ -598,7 +599,32 @@ main(int argc, char *argv[])
598599 target_inclusive , target_tli , target_lsn ,
599600 (target_stop != NULL ) ? target_stop :
600601 (target_immediate ) ? "immediate" : NULL ,
601- target_name , target_action , no_validate );
602+ target_name , target_action );
603+
604+ /* keep all params in one structure */
605+ restore_params = pgut_new (pgRestoreParams );
606+ restore_params -> is_restore = (backup_subcmd == RESTORE_CMD );
607+ restore_params -> no_validate = no_validate ;
608+ restore_params -> restore_as_replica = restore_as_replica ;
609+ restore_params -> skip_block_validation = skip_block_validation ;
610+ restore_params -> skip_external_dirs = skip_external_dirs ;
611+
612+ /* handle partial restore parameters */
613+ if (datname_exclude_list && datname_include_list )
614+ elog (ERROR , "You cannot specify '--db-include' and '--db-exclude' together" );
615+
616+ if (datname_exclude_list )
617+ {
618+ restore_params -> is_include_list = false;
619+ restore_params -> partial_db_list = datname_exclude_list ;
620+ }
621+ else if (datname_include_list )
622+ {
623+ restore_params -> is_include_list = true;
624+ restore_params -> partial_db_list = datname_include_list ;
625+ }
626+
627+
602628 }
603629
604630 if (num_threads < 1 )
@@ -633,37 +659,16 @@ main(int argc, char *argv[])
633659 return do_backup (start_time , no_validate );
634660 }
635661 case RESTORE_CMD :
636- {
637- parray * datname_list = NULL ;
638- /* true for 'include', false for 'exclude' */
639- bool partial_restore_type = false;
640-
641- if (datname_exclude_list && datname_include_list )
642- elog (ERROR , "You cannot specify '--db-include' and '--db-exclude' together" );
643-
644- if (datname_exclude_list )
645- datname_list = datname_exclude_list ;
646-
647- if (datname_include_list )
648- {
649- partial_restore_type = true;
650- datname_list = datname_include_list ;
651- }
652- return do_restore_or_validate (current .backup_id ,
662+ return do_restore_or_validate (current .backup_id ,
653663 recovery_target_options ,
654- true,
655- datname_list ,
656- partial_restore_type );
657- }
664+ restore_params );
658665 case VALIDATE_CMD :
659666 if (current .backup_id == 0 && target_time == 0 && target_xid == 0 )
660667 return do_validate_all ();
661668 else
662669 return do_restore_or_validate (current .backup_id ,
663670 recovery_target_options ,
664- false,
665- NULL ,
666- false);
671+ restore_params );
667672 case SHOW_CMD :
668673 return do_show (current .backup_id );
669674 case DELETE_CMD :
0 commit comments