Tom Lane wrote:
> "Brendan Jurd" <[EMAIL PROTECTED]> writes:
>> Or perhaps the DETAIL portion would be more appropriate as a CONTEXT?
> 
> +1

Is this the proper syntax for errcontext() messags?

//Magnus

Index: hba.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/hba.c,v
retrieving revision 1.167
diff -c -r1.167 hba.c
*** hba.c	15 Sep 2008 12:32:56 -0000	1.167
--- hba.c	15 Sep 2008 17:38:01 -0000
***************
*** 660,666 ****
  					(errcode(ERRCODE_CONFIG_FILE_ERROR),
  					 errmsg("invalid IP address \"%s\": %s",
  							token, gai_strerror(ret)),
! 					 errdetail("In file \"%s\", line %d",
  							   HbaFileName, line_num)));
  			if (cidr_slash)
  				*cidr_slash = '/';
--- 660,666 ----
  					(errcode(ERRCODE_CONFIG_FILE_ERROR),
  					 errmsg("invalid IP address \"%s\": %s",
  							token, gai_strerror(ret)),
! 					 errcontext("File \"%s\", line %d",
  							   HbaFileName, line_num)));
  			if (cidr_slash)
  				*cidr_slash = '/';
***************
*** 697,703 ****
  						(errcode(ERRCODE_CONFIG_FILE_ERROR),
  						 errmsg("invalid IP mask \"%s\": %s",
  								token, gai_strerror(ret)),
! 						 errdetail("In file \"%s\", line %d",
  							   HbaFileName, line_num)));
  				if (gai_result)
  					pg_freeaddrinfo_all(hints.ai_family, gai_result);
--- 697,703 ----
  						(errcode(ERRCODE_CONFIG_FILE_ERROR),
  						 errmsg("invalid IP mask \"%s\": %s",
  								token, gai_strerror(ret)),
! 						 errcontext("File \"%s\", line %d",
  							   HbaFileName, line_num)));
  				if (gai_result)
  					pg_freeaddrinfo_all(hints.ai_family, gai_result);
***************
*** 773,779 ****
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("invalid authentication method \"%s\"",
  						token),
! 				 errdetail("In file \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
--- 773,779 ----
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("invalid authentication method \"%s\"",
  						token),
! 				 errcontext("File \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
***************
*** 784,790 ****
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("invalid authentication method \"%s\": not supported on this platform",
  						token),
! 				 errdetail("In file \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
--- 784,790 ----
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("invalid authentication method \"%s\": not supported on this platform",
  						token),
! 				 errcontext("File \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
***************
*** 796,802 ****
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("krb5 authentication is not supported on local sockets"),
! 				 errdetail("In file \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
--- 796,802 ----
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
  				 errmsg("krb5 authentication is not supported on local sockets"),
! 				 errcontext("File \"%s\" line %d",
  						HbaFileName, line_num)));
  		goto hba_other_error;
  	}
***************
*** 840,852 ****
  	if (line_item)
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
! 				 errmsg("invalid entry in file \"%s\" at line %d, token \"%s\"",
! 						HbaFileName, line_num,
! 						(char *) lfirst(line_item))));
  	else
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
! 				 errmsg("missing field in file \"%s\" at end of line %d",
  						HbaFileName, line_num)));
  
  	/* Come here if suitable message already logged */
--- 840,855 ----
  	if (line_item)
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
! 				 errmsg("invalid token \"%s\"",
! 						(char *) lfirst(line_item)),
! 					errcontext("File %s, line %d",
! 						HbaFileName, line_num)));
  	else
  		ereport(LOG,
  				(errcode(ERRCODE_CONFIG_FILE_ERROR),
! 				 errmsg("missing field at end of line %d",
! 						line_num),
! 				 errcontext("File %s, line %d",
  						HbaFileName, line_num)));
  
  	/* Come here if suitable message already logged */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to