forked from pgaudit/set_user
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompatibility.h
More file actions
91 lines (72 loc) · 2.36 KB
/
compatibility.h
File metadata and controls
91 lines (72 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* -------------------------------------------------------------------------
*
* compatibility.h
*
* Definitions for maintaining compatibility across Postgres versions.
*
* Copyright (c) 2010-2022, PostgreSQL Global Development Group
*
* -------------------------------------------------------------------------
*/
#ifndef SET_USER_COMPAT_H
#define SET_USER_COMPAT_H
#ifndef NO_ASSERT_AUTH_UID_ONCE
#define NO_ASSERT_AUTH_UID_ONCE !USE_ASSERT_CHECKING
#endif
/*
* PostgreSQL version 17+
*
* - Sets bypass_login_check parameter to false in InitializeSessionUserId funcion
*/
#if PG_VERSION_NUM >= 170000
#ifndef INITSESSIONUSER
#define INITSESSIONUSER
#define _InitializeSessionUserId(name,ouserid) InitializeSessionUserId(name,ouserid,false)
#endif
#endif /* 17+ */
/*
* PostgreSQL version 14+
*
* Introduces ReadOnlyTree boolean
*/
#if PG_VERSION_NUM >= 140000
#define _PU_HOOK \
static void PU_hook(PlannedStmt *pstmt, const char *queryString, bool ReadOnlyTree, \
ProcessUtilityContext context, ParamListInfo params, \
QueryEnvironment *queryEnv, \
DestReceiver *dest, QueryCompletion *qc)
#define _prev_hook \
prev_hook(pstmt, queryString, ReadOnlyTree, context, params, queryEnv, dest, qc)
#define _standard_ProcessUtility \
standard_ProcessUtility(pstmt, queryString, ReadOnlyTree, context, params, queryEnv, dest, qc)
#define getObjectIdentity(address) \
getObjectIdentity(address,false)
#endif /* 14+ */
/*
* PostgreSQL version 13+
*
* Introduces QueryCompletion struct
*/
#if PG_VERSION_NUM >= 130000
#ifndef _PU_HOOK
#define _PU_HOOK \
static void PU_hook(PlannedStmt *pstmt, const char *queryString, \
ProcessUtilityContext context, ParamListInfo params, \
QueryEnvironment *queryEnv, \
DestReceiver *dest, QueryCompletion *qc)
#define _prev_hook \
prev_hook(pstmt, queryString, context, params, queryEnv, dest, qc)
#define _standard_ProcessUtility \
standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, dest, qc)
#endif
#ifndef INITSESSIONUSER
#define INITSESSIONUSER
#define _InitializeSessionUserId(name,ouserid) InitializeSessionUserId(name,ouserid)
#endif
#endif /* 13+ */
#if !defined(PG_VERSION_NUM) || PG_VERSION_NUM < 130000
#error "This extension only builds with PostgreSQL 13 or later"
#endif
/* Use our version-specific static declaration here */
_PU_HOOK;
#endif /* SET_USER_COMPAT_H */