-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathspock_common.h
73 lines (62 loc) · 2.09 KB
/
spock_common.h
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
/*-------------------------------------------------------------------------
*
* spock_common.h
* Common code for Spock.
*
* Copyright (c) 2022-2024, pgEdge, Inc.
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, The Regents of the University of California
*
*-------------------------------------------------------------------------
*/
#ifndef SPOCK_COMMON_H
#define SPOCK_COMMON_H
#include "access/amapi.h"
#include "commands/trigger.h"
extern void AfterTriggerBeginQuery(void);
#if PG_VERSION_NUM >= 160000
#include "utils/usercontext.h"
#else /* The following only required for versions prior to PG16 */
/*
* When temporarily changing to run as a different user, this structure
* holds the details needed to restore the original state.
*/
typedef struct UserContext
{
Oid save_userid;
int save_sec_context;
int save_nestlevel;
} UserContext;
#endif
/* Function prototypes. */
extern void SPKSwitchToUntrustedUser(Oid userid, UserContext *context);
extern void SPKRestoreUserContext(UserContext *context);
extern bool SPKExecBRDeleteTriggers(EState *estate,
EPQState *epqstate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
HeapTuple fdw_trigtuple);
extern void SPKExecARDeleteTriggers(EState *estate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
HeapTuple fdw_trigtuple);
extern bool SPKExecBRUpdateTriggers(EState *estate,
EPQState *epqstate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
HeapTuple fdw_trigtuple,
TupleTableSlot *slot);
extern void SPKExecARUpdateTriggers(EState *estate,
ResultRelInfo *relinfo,
ItemPointer tupleid,
HeapTuple fdw_trigtuple,
TupleTableSlot *slot,
List *recheckIndexes);
extern bool SPKExecBRInsertTriggers(EState *estate,
ResultRelInfo *relinfo,
TupleTableSlot *slot);
extern void SPKExecARInsertTriggers(EState *estate,
ResultRelInfo *relinfo,
TupleTableSlot *slot,
List *recheckIndexes);
#endif /* SPOCK_COMMON_H */