ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql_error.h File Reference

Uniform error-reporting macros for ProvSQL. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define provsql_error(fmt, ...)   elog(ERROR, "ProvSQL: " fmt, ##__VA_ARGS__)
 Report a fatal ProvSQL error and abort the current transaction.
 
#define provsql_warning(fmt, ...)   elog(WARNING, "ProvSQL: " fmt, ##__VA_ARGS__)
 Emit a ProvSQL warning message (execution continues).
 
#define provsql_notice(fmt, ...)   elog(NOTICE, "ProvSQL: " fmt, ##__VA_ARGS__)
 Emit a ProvSQL informational notice (execution continues).
 
#define provsql_log(fmt, ...)   elog(LOG, "ProvSQL: " fmt, ##__VA_ARGS__)
 Write a ProvSQL message to the server log only.
 

Detailed Description

Uniform error-reporting macros for ProvSQL.

Defines four convenience macros that wrap PostgreSQL's elog() and always prefix the user-visible message with "ProvSQL: ", giving every diagnostic a consistent origin tag regardless of which source file emits it.

The prefix is inserted by compile-time string-literal concatenation, so fmt must be a string literal (not a runtime char* variable).

Availability of @c elog()

This header intentionally contains no #include directives. The caller is responsible for making elog() visible before including this header:

  • In normal PostgreSQL extension code, elog() comes from <utils/elog.h>, pulled in transitively through postgres.h or provsql_utils.h (which already includes this file at its end).
  • In the standalone tdkc binary, BooleanCircuit.cpp defines a lightweight #define elog stub that writes to stderr and calls exit() on ERROR; provsql_error.h is included after that stub.

Definition in file provsql_error.h.

Macro Definition Documentation

◆ provsql_error

#define provsql_error (   fmt,
  ... 
)    elog(ERROR, "ProvSQL: " fmt, ##__VA_ARGS__)

Report a fatal ProvSQL error and abort the current transaction.

Expands to elog(ERROR, "ProvSQL: " fmt, ...). In PostgreSQL, ERROR performs a non-local exit via longjmp; the call never returns. In the standalone tdkc build the elog stub calls exit(EXIT_FAILURE).

Parameters
fmtA string literal format string (printf-style).
...Optional format arguments.

Definition at line 38 of file provsql_error.h.

◆ provsql_log

#define provsql_log (   fmt,
  ... 
)    elog(LOG, "ProvSQL: " fmt, ##__VA_ARGS__)

Write a ProvSQL message to the server log only.

Expands to elog(LOG, "ProvSQL: " fmt, ...). LOG messages go to the PostgreSQL server log and are not forwarded to the client. Suitable for background-worker lifecycle events (e.g. worker startup).

Parameters
fmtA string literal format string (printf-style).
...Optional format arguments.

Definition at line 73 of file provsql_error.h.

◆ provsql_notice

#define provsql_notice (   fmt,
  ... 
)    elog(NOTICE, "ProvSQL: " fmt, ##__VA_ARGS__)

Emit a ProvSQL informational notice (execution continues).

Expands to elog(NOTICE, "ProvSQL: " fmt, ...). Typically used for progress messages gated on provsql.verbose_level.

Parameters
fmtA string literal format string (printf-style).
...Optional format arguments.

Definition at line 61 of file provsql_error.h.

◆ provsql_warning

#define provsql_warning (   fmt,
  ... 
)    elog(WARNING, "ProvSQL: " fmt, ##__VA_ARGS__)

Emit a ProvSQL warning message (execution continues).

Expands to elog(WARNING, "ProvSQL: " fmt, ...). The message is sent to the client and server log according to the PostgreSQL log_min_messages / client_min_messages settings.

Parameters
fmtA string literal format string (printf-style).
...Optional format arguments.

Definition at line 50 of file provsql_error.h.