diff options
author | Magnus Hagander <magnus@hagander.net> | 2008-09-15 20:55:04 +0000 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2008-09-15 20:55:04 +0000 |
commit | 448950b37b19714d5b4e64ca7b8ea89f50d81974 (patch) | |
tree | 44aae0a2114449df1f21e27b4e085804613b0470 | |
parent | 4adc2f72a4ccd6e55e594aca837f09130a6af62b (diff) | |
download | postgresql-448950b37b19714d5b4e64ca7b8ea89f50d81974.tar.gz postgresql-448950b37b19714d5b4e64ca7b8ea89f50d81974.zip |
Fix error messages from recent pg_hba parsing patch to use errcontext()
to indicate where the error occurred.
-rw-r--r-- | src/backend/libpq/hba.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index a511ee293f6..6917e5c927a 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.167 2008/09/15 12:32:56 mha Exp $ + * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.168 2008/09/15 20:55:04 mha Exp $ * *------------------------------------------------------------------------- */ @@ -660,8 +660,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid IP address \"%s\": %s", token, gai_strerror(ret)), - errdetail("In file \"%s\", line %d", - HbaFileName, line_num))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); if (cidr_slash) *cidr_slash = '/'; if (gai_result) @@ -697,8 +697,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid IP mask \"%s\": %s", token, gai_strerror(ret)), - errdetail("In file \"%s\", line %d", - HbaFileName, line_num))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); if (gai_result) pg_freeaddrinfo_all(hints.ai_family, gai_result); goto hba_other_error; @@ -773,8 +773,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid authentication method \"%s\"", token), - errdetail("In file \"%s\" line %d", - HbaFileName, line_num))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); goto hba_other_error; } @@ -784,8 +784,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid authentication method \"%s\": not supported on this platform", token), - errdetail("In file \"%s\" line %d", - HbaFileName, line_num))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); goto hba_other_error; } @@ -796,8 +796,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline) ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("krb5 authentication is not supported on local sockets"), - errdetail("In file \"%s\" line %d", - HbaFileName, line_num))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); goto hba_other_error; } @@ -840,14 +840,16 @@ hba_syntax: if (line_item) ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("invalid entry in file \"%s\" at line %d, token \"%s\"", - HbaFileName, line_num, - (char *) lfirst(line_item)))); + errmsg("invalid token \"%s\"", + (char *) lfirst(line_item)), + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); else ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("missing field in file \"%s\" at end of line %d", - HbaFileName, line_num))); + errmsg("missing field at end of line"), + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); /* Come here if suitable message already logged */ hba_other_error: |