[PATCH v8 3/6] Standardize IDENT_FIELD_ABSENT error messages

Julien Rouhaud <julien.rouhaud@free.fr>

From: Julien Rouhaud <julien.rouhaud@free.fr>
To:
Date: 2022-07-29T09:21:49Z
Lists: pgsql-hackers
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


--lqayot32rzm7n4sf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="v8-0004-Add-rule_number-mapping_number-to-the-pg_hba-pg_i.patch"