Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

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

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.

{
    if (!PointerIsValid(conditionName)
        || !PointerIsValid(fileName)
        || !PointerIsValid(errorType))
        write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
    else
    {
        write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
                     errorType, conditionName,
                     fileName, lineNumber);
    }

    /* Usually this shouldn't be needed, but make sure the msg went out */
    fflush(stderr);

#ifdef SLEEP_ON_ASSERT

    /*
     * It would be nice to use pg_usleep() here, but only does 2000 sec or 33
     * minutes, which seems too short.
     */
    sleep(1000000);
#endif

    abort();
}