Skip to content

Commit 718fe0a

Browse files
committed
Make consistent a couple of log messages when parsing HBA files
This commit adjusts two log messages: - When a field in pg_ident.conf is not populated, report the line of the configuration file in an error context message instead of the main entry. - When parsing pg_ident.conf and finding an invalid regexp, add some information about the line of the configuration file involved within an error context message. Author: Julien Rouhaud Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud
1 parent 47ab1ac commit 718fe0a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/backend/libpq/hba.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,9 @@ do { \
900900
if (!field) { \
901901
ereport(elevel, \
902902
(errcode(ERRCODE_CONFIG_FILE_ERROR), \
903-
errmsg("missing entry in file \"%s\" at end of line %d", \
904-
IdentFileName, line_num))); \
903+
errmsg("missing entry at end of line"), \
904+
errcontext("line %d of configuration file \"%s\"", \
905+
line_num, IdentFileName))); \
905906
*err_msg = psprintf("missing entry at end of line"); \
906907
return NULL; \
907908
} \
@@ -2372,7 +2373,9 @@ parse_ident_line(TokenizedAuthLine *tok_line, int elevel)
23722373
ereport(elevel,
23732374
(errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
23742375
errmsg("invalid regular expression \"%s\": %s",
2375-
parsedline->ident_user + 1, errstr)));
2376+
parsedline->ident_user + 1, errstr),
2377+
errcontext("line %d of configuration file \"%s\"",
2378+
line_num, IdentFileName)));
23762379

23772380
*err_msg = psprintf("invalid regular expression \"%s\": %s",
23782381
parsedline->ident_user + 1, errstr);

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