[PATCH v8 2/6] Add file name / file line context for incorrect regex in ident files.
Julien Rouhaud <julien.rouhaud@free.fr>
From: Julien Rouhaud <julien.rouhaud@free.fr>
To:
Date: 2022-07-29T06:47:09Z
Lists: pgsql-hackers
For consistency with all other error messages report those information, which
are indeed useful to debug configuration errors.
Author: Julien Rouhaud
Reviewed-by: FIXME
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya%40jrouhaud
---
src/backend/libpq/hba.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 327a4b42af..1ad09f7dc6 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -2372,7 +2372,9 @@ parse_ident_line(TokenizedAuthLine *tok_line, int elevel)
ereport(elevel,
(errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
errmsg("invalid regular expression \"%s\": %s",
- parsedline->ident_user + 1, errstr)));
+ parsedline->ident_user + 1, errstr),
+ errcontext("line %d of configuration file \"%s\"",
+ line_num, IdentFileName)));
*err_msg = psprintf("invalid regular expression \"%s\": %s",
parsedline->ident_user + 1, errstr);
--
2.37.0
--lqayot32rzm7n4sf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0003-Standardize-IDENT_FIELD_ABSENT-error-messages.patch"