PostgreSQL Source Code  git master
assert.c File Reference
#include "postgres.h"
#include <unistd.h>
Include dependency graph for assert.c:

Go to the source code of this file.

Functions

void ExceptionalCondition (const char *conditionName, const char *errorType, const char *fileName, int lineNumber)
 

Function Documentation

◆ ExceptionalCondition()

void ExceptionalCondition ( const char *  conditionName,
const char *  errorType,
const char *  fileName,
int  lineNumber 
)

Definition at line 26 of file assert.c.

References PointerIsValid, and write_stderr.

Referenced by pg_re_throw().

30 {
31  if (!PointerIsValid(conditionName)
32  || !PointerIsValid(fileName)
33  || !PointerIsValid(errorType))
34  write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
35  else
36  {
37  write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
38  errorType, conditionName,
39  fileName, lineNumber);
40  }
41 
42  /* Usually this shouldn't be needed, but make sure the msg went out */
43  fflush(stderr);
44 
45 #ifdef SLEEP_ON_ASSERT
46 
47  /*
48  * It would be nice to use pg_usleep() here, but only does 2000 sec or 33
49  * minutes, which seems too short.
50  */
51  sleep(1000000);
52 #endif
53 
54  abort();
55 }
#define write_stderr(str)
Definition: parallel.c:182
#define PointerIsValid(pointer)
Definition: c.h:626