Skip to content

Commit 448950b

Browse files
committed
Fix error messages from recent pg_hba parsing patch to use errcontext()
to indicate where the error occurred.
1 parent 4adc2f7 commit 448950b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/backend/libpq/hba.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.167 2008/09/15 12:32:56 mha Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.168 2008/09/15 20:55:04 mha Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -660,8 +660,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
660660
(errcode(ERRCODE_CONFIG_FILE_ERROR),
661661
errmsg("invalid IP address \"%s\": %s",
662662
token, gai_strerror(ret)),
663-
errdetail("In file \"%s\", line %d",
664-
HbaFileName, line_num)));
663+
errcontext("line %d of configuration file \"%s\"",
664+
line_num, HbaFileName)));
665665
if (cidr_slash)
666666
*cidr_slash = '/';
667667
if (gai_result)
@@ -697,8 +697,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
697697
(errcode(ERRCODE_CONFIG_FILE_ERROR),
698698
errmsg("invalid IP mask \"%s\": %s",
699699
token, gai_strerror(ret)),
700-
errdetail("In file \"%s\", line %d",
701-
HbaFileName, line_num)));
700+
errcontext("line %d of configuration file \"%s\"",
701+
line_num, HbaFileName)));
702702
if (gai_result)
703703
pg_freeaddrinfo_all(hints.ai_family, gai_result);
704704
goto hba_other_error;
@@ -773,8 +773,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
773773
(errcode(ERRCODE_CONFIG_FILE_ERROR),
774774
errmsg("invalid authentication method \"%s\"",
775775
token),
776-
errdetail("In file \"%s\" line %d",
777-
HbaFileName, line_num)));
776+
errcontext("line %d of configuration file \"%s\"",
777+
line_num, HbaFileName)));
778778
goto hba_other_error;
779779
}
780780

@@ -784,8 +784,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
784784
(errcode(ERRCODE_CONFIG_FILE_ERROR),
785785
errmsg("invalid authentication method \"%s\": not supported on this platform",
786786
token),
787-
errdetail("In file \"%s\" line %d",
788-
HbaFileName, line_num)));
787+
errcontext("line %d of configuration file \"%s\"",
788+
line_num, HbaFileName)));
789789
goto hba_other_error;
790790
}
791791

@@ -796,8 +796,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
796796
ereport(LOG,
797797
(errcode(ERRCODE_CONFIG_FILE_ERROR),
798798
errmsg("krb5 authentication is not supported on local sockets"),
799-
errdetail("In file \"%s\" line %d",
800-
HbaFileName, line_num)));
799+
errcontext("line %d of configuration file \"%s\"",
800+
line_num, HbaFileName)));
801801
goto hba_other_error;
802802
}
803803

@@ -840,14 +840,16 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
840840
if (line_item)
841841
ereport(LOG,
842842
(errcode(ERRCODE_CONFIG_FILE_ERROR),
843-
errmsg("invalid entry in file \"%s\" at line %d, token \"%s\"",
844-
HbaFileName, line_num,
845-
(char *) lfirst(line_item))));
843+
errmsg("invalid token \"%s\"",
844+
(char *) lfirst(line_item)),
845+
errcontext("line %d of configuration file \"%s\"",
846+
line_num, HbaFileName)));
846847
else
847848
ereport(LOG,
848849
(errcode(ERRCODE_CONFIG_FILE_ERROR),
849-
errmsg("missing field in file \"%s\" at end of line %d",
850-
HbaFileName, line_num)));
850+
errmsg("missing field at end of line"),
851+
errcontext("line %d of configuration file \"%s\"",
852+
line_num, HbaFileName)));
851853

852854
/* Come here if suitable message already logged */
853855
hba_other_error:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy