PostgreSQL Source Code
git master
plpython.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* plpython.h - Python as a procedural language for PostgreSQL
4
*
5
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
6
* Portions Copyright (c) 1994, Regents of the University of California
7
*
8
* src/pl/plpython/plpython.h
9
*
10
*-------------------------------------------------------------------------
11
*/
12
#ifndef PLPYTHON_H
13
#define PLPYTHON_H
14
15
/*
16
* Include order should be: postgres.h, other postgres headers, plpython.h,
17
* other plpython headers. (In practice, other plpython headers will also
18
* include this file, so that they can compile standalone.)
19
*/
20
#ifndef POSTGRES_H
21
#error postgres.h must be included before plpython.h
22
#endif
23
24
/*
25
* Undefine some things that get (re)defined in the Python headers. They aren't
26
* used by the PL/Python code, and all PostgreSQL headers should be included
27
* earlier, so this should be pretty safe.
28
*/
29
#undef _POSIX_C_SOURCE
30
#undef _XOPEN_SOURCE
31
32
/*
33
* Sometimes python carefully scribbles on our *printf macros.
34
* So we undefine them here and redefine them after it's done its dirty deed.
35
*/
36
#undef vsnprintf
37
#undef snprintf
38
#undef vsprintf
39
#undef sprintf
40
#undef vfprintf
41
#undef fprintf
42
#undef vprintf
43
#undef printf
44
45
#if defined(_MSC_VER) && defined(_DEBUG)
46
/* Python uses #pragma to bring in a non-default libpython on VC++ if
47
* _DEBUG is defined */
48
#undef _DEBUG
49
/* Also hide away errcode, since we load Python.h before postgres.h */
50
#define errcode __msvc_errcode
51
#include <Python.h>
52
#undef errcode
53
#define _DEBUG
54
#elif defined (_MSC_VER)
55
#define errcode __msvc_errcode
56
#include <Python.h>
57
#undef errcode
58
#else
59
#include <Python.h>
60
#endif
61
62
/* define our text domain for translations */
63
#undef TEXTDOMAIN
64
#define TEXTDOMAIN PG_TEXTDOMAIN("plpython"
)
65
66
/* put back our *printf macros ... this must match src/include/port.h */
67
#ifdef vsnprintf
68
#undef vsnprintf
69
#endif
70
#ifdef snprintf
71
#undef snprintf
72
#endif
73
#ifdef vsprintf
74
#undef vsprintf
75
#endif
76
#ifdef sprintf
77
#undef sprintf
78
#endif
79
#ifdef vfprintf
80
#undef vfprintf
81
#endif
82
#ifdef fprintf
83
#undef fprintf
84
#endif
85
#ifdef vprintf
86
#undef vprintf
87
#endif
88
#ifdef printf
89
#undef printf
90
#endif
91
92
#define vsnprintf pg_vsnprintf
93
#define snprintf pg_snprintf
94
#define vsprintf pg_vsprintf
95
#define sprintf pg_sprintf
96
#define vfprintf pg_vfprintf
97
#define fprintf pg_fprintf
98
#define vprintf pg_vprintf
99
#define printf(...) pg_printf(__VA_ARGS__)
100
101
/*
102
* Used throughout, so it's easier to just include it everywhere.
103
*/
104
#include "
plpy_util.h
"
105
106
#endif
/* PLPYTHON_H */
plpy_util.h
src
pl
plpython
plpython.h
Generated on Sun May 29 2022 06:13:25 for PostgreSQL Source Code by
1.9.1