From 775098bfffaef9f3f380b64c94c94479e9c2513c Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Fri, 29 Jul 2022 17:21:49 +0800 Subject: [PATCH v8 3/6] Standardize IDENT_FIELD_ABSENT error messages The rest of the code emit the file name and line in a distinct errcontext so make IDENT_FIELD_ABSENT consistent. This will help an upcoming commit will add regression tests for variour error scenario. Author: Julien Rouhaud Reviewed-by: FIXME Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya%40jrouhaud --- src/backend/libpq/hba.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 1ad09f7dc6..deee05c197 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -900,8 +900,9 @@ do { \ if (!field) { \ ereport(elevel, \ (errcode(ERRCODE_CONFIG_FILE_ERROR), \ - errmsg("missing entry in file \"%s\" at end of line %d", \ - IdentFileName, line_num))); \ + errmsg("missing entry at end of line"), \ + errcontext("line %d of configuration file \"%s\"", \ + line_num, IdentFileName))); \ *err_msg = psprintf("missing entry at end of line"); \ return NULL; \ } \ -- 2.37.0