Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit735dc1a

Browse files
committed
genbki stricter error handling
Instead of just writing warnings for invalid cross-catalog lookups,count the errors and error out at the end.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/ca8ee41d-241b-1bf3-71f0-aaf1add6d3c5%40enterprisedb.com
1 parentab5e48f commit735dc1a

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/backend/catalog/genbki.pl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
my$major_version;
2727
my$include_path;
2828

29+
my$num_errors = 0;
30+
2931
GetOptions(
3032
'output:s'=> \$output_path,
3133
'set-version:s'=> \$major_version,
@@ -796,7 +798,7 @@
796798
Catalog::RenameTempFile($fk_info_file,$tmpext);
797799
Catalog::RenameTempFile($constraints_file,$tmpext);
798800

799-
exit0;
801+
exit($num_errors != 0 ? 1 : 0);
800802

801803
#################### Subroutines ########################
802804

@@ -1024,8 +1026,7 @@ sub morph_row_for_schemapg
10241026
# Perform OID lookups on an array of OID names.
10251027
# If we don't have a unique value to substitute, warn and
10261028
# leave the entry unchanged.
1027-
# (A warning seems sufficient because the bootstrap backend will reject
1028-
# non-numeric values anyway. So we might as well detect multiple problems
1029+
# (We don't exit right away so that we can detect multiple problems
10291030
# within this genbki.pl run.)
10301031
sublookup_oids
10311032
{
@@ -1045,16 +1046,20 @@ sub lookup_oids
10451046
push@lookupoids,$lookupname;
10461047
if ($lookupnameeq'-'or$lookupnameeq'0')
10471048
{
1048-
warnsprintf
1049-
"invalid zero OID reference in%s.dat field%s line%s\n",
1050-
$catname,$attname,$bki_values->{line_number}
1051-
if !$lookup_opt;
1049+
if (!$lookup_opt)
1050+
{
1051+
warnsprintf
1052+
"invalid zero OID reference in%s.dat field%s line%s\n",
1053+
$catname,$attname,$bki_values->{line_number};
1054+
$num_errors++;
1055+
}
10521056
}
10531057
else
10541058
{
10551059
warnsprintf
10561060
"unresolved OID reference\"%s\" in%s.dat field%s line%s\n",
10571061
$lookupname,$catname,$attname,$bki_values->{line_number};
1062+
$num_errors++;
10581063
}
10591064
}
10601065
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp