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

Commit25f915b

Browse files
committed
pg_waldump: Improve option parsing error messages
I rephrased the error messages to be more in the style ofoption_parse_int(), and also made use of the new "detail" messagefacility. I didn't actually use option_parse_int() (which could beused for -n) because libpgfeutils wasn't used here yet and I wanted tokeep this just to string changes. But it could be done in the future.
1 parent1d8ef62 commit25f915b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ main(int argc, char **argv)
794794
if (sscanf(optarg,"%u",&config.filter_by_relation_block)!=1||
795795
!BlockNumberIsValid(config.filter_by_relation_block))
796796
{
797-
pg_log_error("could not parse validblock number \"%s\"",optarg);
797+
pg_log_error("invalidblock number: \"%s\"",optarg);
798798
gotobad_argument;
799799
}
800800
config.filter_by_relation_block_enabled= true;
@@ -803,7 +803,7 @@ main(int argc, char **argv)
803803
case'e':
804804
if (sscanf(optarg,"%X/%X",&xlogid,&xrecoff)!=2)
805805
{
806-
pg_log_error("could not parse endWAL location \"%s\"",
806+
pg_log_error("invalidWAL location: \"%s\"",
807807
optarg);
808808
gotobad_argument;
809809
}
@@ -816,15 +816,15 @@ main(int argc, char **argv)
816816
config.filter_by_relation_forknum=forkname_to_number(optarg);
817817
if (config.filter_by_relation_forknum==InvalidForkNumber)
818818
{
819-
pg_log_error("could not parsefork \"%s\"",optarg);
819+
pg_log_error("invalidfork name: \"%s\"",optarg);
820820
gotobad_argument;
821821
}
822822
config.filter_by_extended= true;
823823
break;
824824
case'n':
825825
if (sscanf(optarg,"%d",&config.stop_after_records)!=1)
826826
{
827-
pg_log_error("could not parse limit\"%s\"",optarg);
827+
pg_log_error("invalid value\"%s\" for option %s",optarg,"-n/--limit");
828828
gotobad_argument;
829829
}
830830
break;
@@ -891,9 +891,8 @@ main(int argc, char **argv)
891891
!OidIsValid(config.filter_by_relation.spcNode)||
892892
!OidIsValid(config.filter_by_relation.relNode))
893893
{
894-
pg_log_error("could not parse valid relation from \"%s\""
895-
" (expecting \"tablespace OID/database OID/"
896-
"relation filenode\")",optarg);
894+
pg_log_error("invalid relation specification: \"%s\"",optarg);
895+
pg_log_error_detail("Expecting \"tablespace OID/database OID/relation filenode\".");
897896
gotobad_argument;
898897
}
899898
config.filter_by_relation_enabled= true;
@@ -902,7 +901,7 @@ main(int argc, char **argv)
902901
case's':
903902
if (sscanf(optarg,"%X/%X",&xlogid,&xrecoff)!=2)
904903
{
905-
pg_log_error("could not parse startWAL location \"%s\"",
904+
pg_log_error("invalidWAL location: \"%s\"",
906905
optarg);
907906
gotobad_argument;
908907
}
@@ -912,7 +911,7 @@ main(int argc, char **argv)
912911
case't':
913912
if (sscanf(optarg,"%u",&private.timeline)!=1)
914913
{
915-
pg_log_error("could not parsetimeline \"%s\"",optarg);
914+
pg_log_error("invalidtimeline specification: \"%s\"",optarg);
916915
gotobad_argument;
917916
}
918917
break;
@@ -922,7 +921,7 @@ main(int argc, char **argv)
922921
case'x':
923922
if (sscanf(optarg,"%u",&config.filter_by_xid)!=1)
924923
{
925-
pg_log_error("could not parse\"%s\" as a transaction ID",
924+
pg_log_error("invalid transaction ID specification:\"%s\"",
926925
optarg);
927926
gotobad_argument;
928927
}
@@ -937,8 +936,8 @@ main(int argc, char **argv)
937936
config.stats_per_record= true;
938937
elseif (strcmp(optarg,"rmgr")!=0)
939938
{
940-
pg_log_error("unrecognizedargument to --stats: %s",
941-
optarg);
939+
pg_log_error("unrecognizedvalue for option %s: %s",
940+
"--stats",optarg);
942941
gotobad_argument;
943942
}
944943
}
@@ -951,7 +950,8 @@ main(int argc, char **argv)
951950
if (config.filter_by_relation_block_enabled&&
952951
!config.filter_by_relation_enabled)
953952
{
954-
pg_log_error("--block option requires --relation option to be specified");
953+
pg_log_error("option %s requires option %s to be specified",
954+
"-B/--block","-R/--relation");
955955
gotobad_argument;
956956
}
957957

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp