Revert dubious message wording change.
[PostgreSQL.git] / src / backend / utils / error / assert.c
blobd2d64277b875bacd89164c8b347fa86802866b3e
1 /*-------------------------------------------------------------------------
3 * assert.c
4 * Assert code.
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * IDENTIFICATION
11 * $PostgreSQL$
13 * NOTE
14 * This should eventually work with elog()
16 *-------------------------------------------------------------------------
18 #include "postgres.h"
20 #include <unistd.h>
23 * ExceptionalCondition - Handles the failure of an Assert()
25 * Note: this can't actually return, but we declare it as returning int
26 * because the TrapMacro() macro might get wonky otherwise.
28 int
29 ExceptionalCondition(const char *conditionName,
30 const char *errorType,
31 const char *fileName,
32 int lineNumber)
34 if (!PointerIsValid(conditionName)
35 || !PointerIsValid(fileName)
36 || !PointerIsValid(errorType))
37 write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
38 else
40 write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
41 errorType, conditionName,
42 fileName, lineNumber);
45 /* Usually this shouldn't be needed, but make sure the msg went out */
46 fflush(stderr);
48 #ifdef SLEEP_ON_ASSERT
51 * It would be nice to use pg_usleep() here, but only does 2000 sec or 33
52 * minutes, which seems too short.
54 sleep(1000000);
55 #endif
57 abort();
59 return 0;