-
Notifications
You must be signed in to change notification settings - Fork 0
/
rowstamp.h
44 lines (36 loc) · 811 Bytes
/
rowstamp.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
#ifndef _ROWSTAMP_H_
#define _ROWSTAMP_H_
/*
* Row version check changed in 8.3
*/
#if PG_VERSION_NUM < 80300
#define ROWSTAMP_PRE83
#endif
/*
* Row version info
*/
typedef struct RowStamp {
TransactionId xmin;
#ifdef ROWSTAMP_PRE83
CommandId cmin;
#else
ItemPointerData tid;
#endif
} RowStamp;
static void rowstamp_set(RowStamp *stamp, HeapTuple tup) {
stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
#ifdef ROWSTAMP_PRE83
stamp->cmin = HeapTupleHeaderGetCmin(tup->t_data);
#else
stamp->tid = tup->t_self;
#endif
}
static bool rowstamp_check(RowStamp *stamp, HeapTuple tup) {
return stamp->xmin == HeapTupleHeaderGetXmin(tup->t_data)
#ifdef ROWSTAMP_PRE83
&& stamp->cmin == HeapTupleHeaderGetCmin(tup->t_data);
#else
&& ItemPointerEquals(&stamp->tid, &tup->t_self);
#endif
}
#endif