@@ -711,7 +711,6 @@ check_proper_datallowconn(ClusterInfo *cluster)
711711 int i_datallowconn ;
712712 FILE * script = NULL ;
713713 char output_path [MAXPGPATH ];
714- bool found = false;
715714
716715 prep_status ("Checking database connection settings" );
717716
@@ -750,7 +749,6 @@ check_proper_datallowconn(ClusterInfo *cluster)
750749 */
751750 if (strcmp (datallowconn , "f" ) == 0 )
752751 {
753- found = true;
754752 if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
755753 pg_fatal ("could not open file \"%s\": %s" ,
756754 output_path , strerror (errno ));
@@ -765,10 +763,8 @@ check_proper_datallowconn(ClusterInfo *cluster)
765763 PQfinish (conn_template1 );
766764
767765 if (script )
768- fclose (script );
769-
770- if (found )
771766 {
767+ fclose (script );
772768 pg_log (PG_REPORT , "fatal" );
773769 pg_fatal ("All non-template0 databases must allow connections, i.e. their\n"
774770 "pg_database.datallowconn must be true. Your installation contains\n"
@@ -829,7 +825,6 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
829825{
830826 int dbnum ;
831827 FILE * script = NULL ;
832- bool found = false;
833828 char output_path [MAXPGPATH ];
834829
835830 prep_status ("Checking for contrib/isn with bigint-passing mismatch" );
@@ -870,7 +865,6 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
870865 i_proname = PQfnumber (res , "proname" );
871866 for (rowno = 0 ; rowno < ntups ; rowno ++ )
872867 {
873- found = true;
874868 if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
875869 pg_fatal ("could not open file \"%s\": %s" ,
876870 output_path , strerror (errno ));
@@ -890,10 +884,8 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
890884 }
891885
892886 if (script )
893- fclose (script );
894-
895- if (found )
896887 {
888+ fclose (script );
897889 pg_log (PG_REPORT , "fatal" );
898890 pg_fatal ("Your installation contains \"contrib/isn\" functions which rely on the\n"
899891 "bigint data type. Your old and new clusters pass bigint values\n"
@@ -915,7 +907,6 @@ check_for_user_defined_postfix_ops(ClusterInfo *cluster)
915907{
916908 int dbnum ;
917909 FILE * script = NULL ;
918- bool found = false;
919910 char output_path [MAXPGPATH ];
920911
921912 prep_status ("Checking for user-defined postfix operators" );
@@ -968,7 +959,6 @@ check_for_user_defined_postfix_ops(ClusterInfo *cluster)
968959 i_typname = PQfnumber (res , "typname" );
969960 for (rowno = 0 ; rowno < ntups ; rowno ++ )
970961 {
971- found = true;
972962 if (script == NULL &&
973963 (script = fopen_priv (output_path , "w" )) == NULL )
974964 pg_fatal ("could not open file \"%s\": %s" ,
@@ -992,10 +982,8 @@ check_for_user_defined_postfix_ops(ClusterInfo *cluster)
992982 }
993983
994984 if (script )
995- fclose (script );
996-
997- if (found )
998985 {
986+ fclose (script );
999987 pg_log (PG_REPORT , "fatal" );
1000988 pg_fatal ("Your installation contains user-defined postfix operators, which are not\n"
1001989 "supported anymore. Consider dropping the postfix operators and replacing\n"
@@ -1145,7 +1133,6 @@ check_for_tables_with_oids(ClusterInfo *cluster)
11451133{
11461134 int dbnum ;
11471135 FILE * script = NULL ;
1148- bool found = false;
11491136 char output_path [MAXPGPATH ];
11501137
11511138 prep_status ("Checking for tables WITH OIDS" );
@@ -1179,7 +1166,6 @@ check_for_tables_with_oids(ClusterInfo *cluster)
11791166 i_relname = PQfnumber (res , "relname" );
11801167 for (rowno = 0 ; rowno < ntups ; rowno ++ )
11811168 {
1182- found = true;
11831169 if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
11841170 pg_fatal ("could not open file \"%s\": %s" ,
11851171 output_path , strerror (errno ));
@@ -1199,10 +1185,8 @@ check_for_tables_with_oids(ClusterInfo *cluster)
11991185 }
12001186
12011187 if (script )
1202- fclose (script );
1203-
1204- if (found )
12051188 {
1189+ fclose (script );
12061190 pg_log (PG_REPORT , "fatal" );
12071191 pg_fatal ("Your installation contains tables declared WITH OIDS, which is not\n"
12081192 "supported anymore. Consider removing the oid column using\n"
@@ -1401,7 +1385,6 @@ check_for_user_defined_encoding_conversions(ClusterInfo *cluster)
14011385{
14021386 int dbnum ;
14031387 FILE * script = NULL ;
1404- bool found = false;
14051388 char output_path [MAXPGPATH ];
14061389
14071390 prep_status ("Checking for user-defined encoding conversions" );
@@ -1441,7 +1424,6 @@ check_for_user_defined_encoding_conversions(ClusterInfo *cluster)
14411424 i_nspname = PQfnumber (res , "nspname" );
14421425 for (rowno = 0 ; rowno < ntups ; rowno ++ )
14431426 {
1444- found = true;
14451427 if (script == NULL &&
14461428 (script = fopen_priv (output_path , "w" )) == NULL )
14471429 pg_fatal ("could not open file \"%s\": %s" ,
@@ -1463,10 +1445,8 @@ check_for_user_defined_encoding_conversions(ClusterInfo *cluster)
14631445 }
14641446
14651447 if (script )
1466- fclose (script );
1467-
1468- if (found )
14691448 {
1449+ fclose (script );
14701450 pg_log (PG_REPORT , "fatal" );
14711451 pg_fatal ("Your installation contains user-defined encoding conversions.\n"
14721452 "The conversion function parameters changed in PostgreSQL version 14\n"
0 commit comments