mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Error message editing in backend/libpq, backend/postmaster, backend/tcop.
Along the way, fix some logic problems in pgstat_initstats, notably the bogus assumption that malloc returns zeroed memory.
This commit is contained in:
@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.113 2003/07/18 23:20:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.114 2003/07/22 19:00:12 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -572,6 +572,42 @@ errcode_for_file_access(void)
|
||||
return 0; /* return value does not matter */
|
||||
}
|
||||
|
||||
/*
|
||||
* errcode_for_socket_access --- add SQLSTATE error code to the current error
|
||||
*
|
||||
* The SQLSTATE code is chosen based on the saved errno value. We assume
|
||||
* that the failing operation was some type of socket access.
|
||||
*
|
||||
* NOTE: the primary error message string should generally include %m
|
||||
* when this is used.
|
||||
*/
|
||||
int
|
||||
errcode_for_socket_access(void)
|
||||
{
|
||||
ErrorData *edata = &errordata[errordata_stack_depth];
|
||||
|
||||
/* we don't bother incrementing recursion_depth */
|
||||
CHECK_STACK_DEPTH();
|
||||
|
||||
switch (edata->saved_errno)
|
||||
{
|
||||
/* Loss of connection */
|
||||
case EPIPE:
|
||||
#ifdef ECONNRESET
|
||||
case ECONNRESET:
|
||||
#endif
|
||||
edata->sqlerrcode = ERRCODE_CONNECTION_FAILURE;
|
||||
break;
|
||||
|
||||
/* All else is classified as internal errors */
|
||||
default:
|
||||
edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; /* return value does not matter */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This macro handles expansion of a format string and associated parameters;
|
||||
|
Reference in New Issue
Block a user