-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathtemporal_tables.h
44 lines (35 loc) · 1.15 KB
/
temporal_tables.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
/* -------------------------------------------------------------------------
*
* temporal_tables.h
*
* Copyright (c) 2012-2023 Vladislav Arkhipov <[email protected]>
*
* -------------------------------------------------------------------------
*/
#ifndef __TEMPORAL_TABLES_H__
#define __TEMPORAL_TABLES_H__
#include "postgres.h"
#include "fmgr.h"
#include "access/xact.h"
typedef enum SystemTimeMode
{
/* use CURRENT_TIMESTAMP */
CurrentTransactionStartTimestamp,
/* use the value stored in the system_time field of TemporalContext */
UserDefined
} SystemTimeMode;
typedef struct TemporalContext
{
/* the subtransaction that this context was created in */
SubTransactionId subid;
/* the current system time mode */
SystemTimeMode system_time_mode;
/* the system time that is used by triggers in the UserDefined mode */
TimestampTz system_time;
} TemporalContext;
/* Get the TemporalContext that is associated with the current transaction. If
* will_modify is true, the caller is permitted to modify the returned value.
* Otherwise, the returned value must not be changed.
*/
TemporalContext *get_current_temporal_context(bool will_modify);
#endif