PostgreSQL Source Code git master
Loading...
Searching...
No Matches
plpy_elog.h File Reference
#include "plpython.h"
Include dependency graph for plpy_elog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PLy_elog(elevel, ...)
 

Functions

PGDLLEXPORT void PLy_elog_impl (int elevel, const char *fmt,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set (PyObject *exc, const char *fmt,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set_plural (PyObject *exc, const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void pg_attribute_printf (3, 5)
 
PGDLLEXPORT void PLy_exception_set_with_details (PyObject *excclass, ErrorData *edata)
 

Variables

PyObjectPLy_exc_error
 
PyObjectPLy_exc_fatal
 
PyObjectPLy_exc_spi_error
 

Macro Definition Documentation

◆ PLy_elog

#define PLy_elog (   elevel,
  ... 
)
Value:
do { \
const int elevel_ = (elevel); \
} while(0)
#define ERROR
Definition elog.h:39
static int fb(int x)

Definition at line 28 of file plpy_elog.h.

29 { \
30 const int elevel_ = (elevel); \
32 if (elevel_ >= ERROR) \
34 } while(0)

Function Documentation

◆ pg_attribute_printf()

PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void pg_attribute_printf ( ,
 
)

◆ PLy_elog_impl()

PGDLLEXPORT void PLy_elog_impl ( int  elevel,
const char fmt,
  ... 
)
extern

◆ PLy_exception_set()

PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set ( PyObject exc,
const char fmt,
  ... 
)
extern

◆ PLy_exception_set_plural()

PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set_plural ( PyObject exc,
const char fmt_singular,
const char fmt_plural,
unsigned long  n,
  ... 
)
extern

◆ PLy_exception_set_with_details()

PGDLLEXPORT void PLy_exception_set_with_details ( PyObject excclass,
ErrorData edata 
)
extern

Definition at line 522 of file plpy_elog.c.

523{
524 PyObject *args = NULL;
526
527 args = Py_BuildValue("(s)", edata->message);
528 if (!args)
529 goto failure;
530
531 /* create a new exception with the error message as the parameter */
533 if (!error)
534 goto failure;
535
536 if (!set_string_attr(error, "sqlstate",
537 unpack_sql_state(edata->sqlerrcode)))
538 goto failure;
539
540 if (!set_string_attr(error, "detail", edata->detail))
541 goto failure;
542
543 if (!set_string_attr(error, "hint", edata->hint))
544 goto failure;
545
546 if (!set_string_attr(error, "query", edata->internalquery))
547 goto failure;
548
549 if (!set_string_attr(error, "schema_name", edata->schema_name))
550 goto failure;
551
552 if (!set_string_attr(error, "table_name", edata->table_name))
553 goto failure;
554
555 if (!set_string_attr(error, "column_name", edata->column_name))
556 goto failure;
557
558 if (!set_string_attr(error, "datatype_name", edata->datatype_name))
559 goto failure;
560
561 if (!set_string_attr(error, "constraint_name", edata->constraint_name))
562 goto failure;
563
565
566 Py_DECREF(args);
568
569 return;
570
571failure:
572 Py_XDECREF(args);
574
575 elog(ERROR, "could not convert error to Python exception");
576}
char * unpack_sql_state(int sql_state)
Definition elog.c:3222
#define elog(elevel,...)
Definition elog.h:226
static bool set_string_attr(PyObject *obj, char *attrname, char *str)
Definition plpy_elog.c:596
static void error(void)

References elog, ERROR, error(), fb(), set_string_attr(), and unpack_sql_state().

Referenced by PLy_output().

Variable Documentation

◆ PLy_exc_error

◆ PLy_exc_fatal

PyObject* PLy_exc_fatal
extern

Definition at line 16 of file plpy_elog.c.

Referenced by PLy_add_exceptions(), and PLy_elog_impl().

◆ PLy_exc_spi_error