@@ -158,16 +158,15 @@ check_new_cluster(void)
158
158
* matching install-user oids.
159
159
*/
160
160
if (old_cluster .install_role_oid != new_cluster .install_role_oid )
161
- pg_log (PG_FATAL ,
162
- "Old and new cluster install users have different values for pg_authid.oid.\n" );
161
+ pg_fatal ("Old and new cluster install users have different values for pg_authid.oid.\n" );
163
162
164
163
/*
165
164
* We only allow the install user in the new cluster because other defined
166
165
* users might match users defined in the old cluster and generate an
167
166
* error during pg_dump restore.
168
167
*/
169
168
if (new_cluster .role_count != 1 )
170
- pg_log ( PG_FATAL , "Only the install user can be defined in the new cluster.\n" );
169
+ pg_fatal ( "Only the install user can be defined in the new cluster.\n" );
171
170
172
171
check_for_prepared_transactions (& new_cluster );
173
172
}
@@ -271,11 +270,11 @@ check_cluster_versions(void)
271
270
*/
272
271
273
272
if (GET_MAJOR_VERSION (old_cluster .major_version ) < 803 )
274
- pg_log ( PG_FATAL , "This utility can only upgrade from PostgreSQL version 8.3 and later.\n" );
273
+ pg_fatal ( "This utility can only upgrade from PostgreSQL version 8.3 and later.\n" );
275
274
276
275
/* Only current PG version is supported as a target */
277
276
if (GET_MAJOR_VERSION (new_cluster .major_version ) != GET_MAJOR_VERSION (PG_VERSION_NUM ))
278
- pg_log ( PG_FATAL , "This utility can only upgrade to PostgreSQL version %s.\n" ,
277
+ pg_fatal ( "This utility can only upgrade to PostgreSQL version %s.\n" ,
279
278
PG_MAJORVERSION );
280
279
281
280
/*
@@ -284,7 +283,7 @@ check_cluster_versions(void)
284
283
* versions.
285
284
*/
286
285
if (old_cluster .major_version > new_cluster .major_version )
287
- pg_log ( PG_FATAL , "This utility cannot be used to downgrade to older major PostgreSQL versions.\n" );
286
+ pg_fatal ( "This utility cannot be used to downgrade to older major PostgreSQL versions.\n" );
288
287
289
288
/* get old and new binary versions */
290
289
get_bin_version (& old_cluster );
@@ -293,12 +292,10 @@ check_cluster_versions(void)
293
292
/* Ensure binaries match the designated data directories */
294
293
if (GET_MAJOR_VERSION (old_cluster .major_version ) !=
295
294
GET_MAJOR_VERSION (old_cluster .bin_version ))
296
- pg_log (PG_FATAL ,
297
- "Old cluster data and binary directories are from different major versions.\n" );
295
+ pg_fatal ("Old cluster data and binary directories are from different major versions.\n" );
298
296
if (GET_MAJOR_VERSION (new_cluster .major_version ) !=
299
297
GET_MAJOR_VERSION (new_cluster .bin_version ))
300
- pg_log (PG_FATAL ,
301
- "New cluster data and binary directories are from different major versions.\n" );
298
+ pg_fatal ("New cluster data and binary directories are from different major versions.\n" );
302
299
303
300
check_ok ();
304
301
}
@@ -315,17 +312,17 @@ check_cluster_compatibility(bool live_check)
315
312
/* Is it 9.0 but without tablespace directories? */
316
313
if (GET_MAJOR_VERSION (new_cluster .major_version ) == 900 &&
317
314
new_cluster .controldata .cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER )
318
- pg_log ( PG_FATAL , "This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n"
315
+ pg_fatal ( "This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n"
319
316
"because of backend API changes made during development.\n" );
320
317
321
318
/* We read the real port number for PG >= 9.1 */
322
319
if (live_check && GET_MAJOR_VERSION (old_cluster .major_version ) < 901 &&
323
320
old_cluster .port == DEF_PGUPORT )
324
- pg_log ( PG_FATAL , "When checking a pre-PG 9.1 live old server, "
321
+ pg_fatal ( "When checking a pre-PG 9.1 live old server, "
325
322
"you must specify the old server's port number.\n" );
326
323
327
324
if (live_check && old_cluster .port == new_cluster .port )
328
- pg_log ( PG_FATAL , "When checking a live server, "
325
+ pg_fatal ( "When checking a live server, "
329
326
"the old and new port numbers must be different.\n" );
330
327
}
331
328
@@ -413,16 +410,13 @@ check_locale_and_encoding(ControlData *oldctrl,
413
410
* UTF-8 vs. UTF8, so at least we display the mismatching values.
414
411
*/
415
412
if (pg_strcasecmp (oldctrl -> lc_collate , newctrl -> lc_collate ) != 0 )
416
- pg_log (PG_FATAL ,
417
- "lc_collate cluster values do not match: old \"%s\", new \"%s\"\n" ,
413
+ pg_fatal ("lc_collate cluster values do not match: old \"%s\", new \"%s\"\n" ,
418
414
oldctrl -> lc_collate , newctrl -> lc_collate );
419
415
if (pg_strcasecmp (oldctrl -> lc_ctype , newctrl -> lc_ctype ) != 0 )
420
- pg_log (PG_FATAL ,
421
- "lc_ctype cluster values do not match: old \"%s\", new \"%s\"\n" ,
416
+ pg_fatal ("lc_ctype cluster values do not match: old \"%s\", new \"%s\"\n" ,
422
417
oldctrl -> lc_ctype , newctrl -> lc_ctype );
423
418
if (pg_strcasecmp (oldctrl -> encoding , newctrl -> encoding ) != 0 )
424
- pg_log (PG_FATAL ,
425
- "encoding cluster values do not match: old \"%s\", new \"%s\"\n" ,
419
+ pg_fatal ("encoding cluster values do not match: old \"%s\", new \"%s\"\n" ,
426
420
oldctrl -> encoding , newctrl -> encoding );
427
421
}
428
422
@@ -442,7 +436,7 @@ check_new_cluster_is_empty(void)
442
436
{
443
437
/* pg_largeobject and its index should be skipped */
444
438
if (strcmp (rel_arr -> rels [relnum ].nspname , "pg_catalog" ) != 0 )
445
- pg_log ( PG_FATAL , "New cluster database \"%s\" is not empty\n" ,
439
+ pg_fatal ( "New cluster database \"%s\" is not empty\n" ,
446
440
new_cluster .dbarr .dbs [dbnum ].db_name );
447
441
}
448
442
}
@@ -475,7 +469,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
475
469
SCRIPT_EXT );
476
470
477
471
if ((script = fopen_priv (* analyze_script_file_name , "w" )) == NULL )
478
- pg_log ( PG_FATAL , "Could not open file \"%s\": %s\n" ,
472
+ pg_fatal ( "Could not open file \"%s\": %s\n" ,
479
473
* analyze_script_file_name , getErrorText (errno ));
480
474
481
475
#ifndef WIN32
@@ -580,7 +574,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
580
574
581
575
#ifndef WIN32
582
576
if (chmod (* analyze_script_file_name , S_IRWXU ) != 0 )
583
- pg_log ( PG_FATAL , "Could not add execute permission to file \"%s\": %s\n" ,
577
+ pg_fatal ( "Could not add execute permission to file \"%s\": %s\n" ,
584
578
* analyze_script_file_name , getErrorText (errno ));
585
579
#endif
586
580
@@ -634,7 +628,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
634
628
prep_status ("Creating script to delete old cluster" );
635
629
636
630
if ((script = fopen_priv (* deletion_script_file_name , "w" )) == NULL )
637
- pg_log ( PG_FATAL , "Could not open file \"%s\": %s\n" ,
631
+ pg_fatal ( "Could not open file \"%s\": %s\n" ,
638
632
* deletion_script_file_name , getErrorText (errno ));
639
633
640
634
#ifndef WIN32
@@ -688,7 +682,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
688
682
689
683
#ifndef WIN32
690
684
if (chmod (* deletion_script_file_name , S_IRWXU ) != 0 )
691
- pg_log ( PG_FATAL , "Could not add execute permission to file \"%s\": %s\n" ,
685
+ pg_fatal ( "Could not add execute permission to file \"%s\": %s\n" ,
692
686
* deletion_script_file_name , getErrorText (errno ));
693
687
#endif
694
688
@@ -716,7 +710,7 @@ check_is_super_user(ClusterInfo *cluster)
716
710
"WHERE rolname = current_user" );
717
711
718
712
if (PQntuples (res ) != 1 || strcmp (PQgetvalue (res , 0 , 0 ), "t" ) != 0 )
719
- pg_log ( PG_FATAL , "database user \"%s\" is not a superuser\n" ,
713
+ pg_fatal ( "database user \"%s\" is not a superuser\n" ,
720
714
os_info .user );
721
715
722
716
cluster -> install_role_oid = atooid (PQgetvalue (res , 0 , 1 ));
@@ -728,7 +722,7 @@ check_is_super_user(ClusterInfo *cluster)
728
722
"FROM pg_catalog.pg_roles " );
729
723
730
724
if (PQntuples (res ) != 1 )
731
- pg_log ( PG_FATAL , "could not determine the number of users\n" );
725
+ pg_fatal ( "could not determine the number of users\n" );
732
726
733
727
cluster -> role_count = atoi (PQgetvalue (res , 0 , 0 ));
734
728
@@ -759,7 +753,7 @@ check_for_prepared_transactions(ClusterInfo *cluster)
759
753
"FROM pg_catalog.pg_prepared_xacts" );
760
754
761
755
if (PQntuples (res ) != 0 )
762
- pg_log ( PG_FATAL , "The %s cluster contains prepared transactions\n" ,
756
+ pg_fatal ( "The %s cluster contains prepared transactions\n" ,
763
757
CLUSTER_NAME (cluster ));
764
758
765
759
PQclear (res );
@@ -824,7 +818,7 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
824
818
{
825
819
found = true;
826
820
if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
827
- pg_log ( PG_FATAL , "Could not open file \"%s\": %s\n" ,
821
+ pg_fatal ( "Could not open file \"%s\": %s\n" ,
828
822
output_path , getErrorText (errno ));
829
823
if (!db_used )
830
824
{
@@ -847,8 +841,7 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
847
841
if (found )
848
842
{
849
843
pg_log (PG_REPORT , "fatal\n" );
850
- pg_log (PG_FATAL ,
851
- "Your installation contains \"contrib/isn\" functions which rely on the\n"
844
+ pg_fatal ("Your installation contains \"contrib/isn\" functions which rely on the\n"
852
845
"bigint data type. Your old and new clusters pass bigint values\n"
853
846
"differently so this cluster cannot currently be upgraded. You can\n"
854
847
"manually upgrade databases that use \"contrib/isn\" facilities and remove\n"
@@ -929,7 +922,7 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
929
922
{
930
923
found = true;
931
924
if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
932
- pg_log ( PG_FATAL , "Could not open file \"%s\": %s\n" ,
925
+ pg_fatal ( "Could not open file \"%s\": %s\n" ,
933
926
output_path , getErrorText (errno ));
934
927
if (!db_used )
935
928
{
@@ -953,8 +946,7 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
953
946
if (found )
954
947
{
955
948
pg_log (PG_REPORT , "fatal\n" );
956
- pg_log (PG_FATAL ,
957
- "Your installation contains one of the reg* data types in user tables.\n"
949
+ pg_fatal ("Your installation contains one of the reg* data types in user tables.\n"
958
950
"These data types reference system OIDs that are not preserved by\n"
959
951
"pg_upgrade, so this cluster cannot currently be upgraded. You can\n"
960
952
"remove the problem tables and restart the upgrade. A list of the problem\n"
@@ -979,7 +971,7 @@ get_bin_version(ClusterInfo *cluster)
979
971
980
972
if ((output = popen (cmd , "r" )) == NULL ||
981
973
fgets (cmd_output , sizeof (cmd_output ), output ) == NULL )
982
- pg_log ( PG_FATAL , "Could not get pg_ctl version data using %s: %s\n" ,
974
+ pg_fatal ( "Could not get pg_ctl version data using %s: %s\n" ,
983
975
cmd , getErrorText (errno ));
984
976
985
977
pclose (output );
@@ -989,7 +981,7 @@ get_bin_version(ClusterInfo *cluster)
989
981
* strchr (cmd_output , '\n' ) = '\0' ;
990
982
991
983
if (sscanf (cmd_output , "%*s %*s %d.%d" , & pre_dot , & post_dot ) != 2 )
992
- pg_log ( PG_FATAL , "could not get version from %s\n" , cmd );
984
+ pg_fatal ( "could not get version from %s\n" , cmd );
993
985
994
986
cluster -> bin_version = (pre_dot * 100 + post_dot ) * 100 ;
995
987
}
@@ -1009,7 +1001,7 @@ get_canonical_locale_name(int category, const char *locale)
1009
1001
1010
1002
save = setlocale (category , NULL );
1011
1003
if (!save )
1012
- pg_log ( PG_FATAL , "failed to get the current locale\n" );
1004
+ pg_fatal ( "failed to get the current locale\n" );
1013
1005
1014
1006
/* 'save' may be pointing at a modifiable scratch variable, so copy it. */
1015
1007
save = pg_strdup (save );
@@ -1018,13 +1010,13 @@ get_canonical_locale_name(int category, const char *locale)
1018
1010
res = setlocale (category , locale );
1019
1011
1020
1012
if (!res )
1021
- pg_log ( PG_FATAL , "failed to get system local name for \"%s\"\n" , res );
1013
+ pg_fatal ( "failed to get system local name for \"%s\"\n" , res );
1022
1014
1023
1015
res = pg_strdup (res );
1024
1016
1025
1017
/* restore old value. */
1026
1018
if (!setlocale (category , save ))
1027
- pg_log ( PG_FATAL , "failed to restore old locale \"%s\"\n" , save );
1019
+ pg_fatal ( "failed to restore old locale \"%s\"\n" , save );
1028
1020
1029
1021
pg_free (save );
1030
1022
0 commit comments