File: rowstamp.h

package info (click to toggle)
postgresql-pllua 1%3A0.3.2-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 376 kB
  • sloc: ansic: 1,839; sql: 253; makefile: 50
file content (44 lines) | stat: -rw-r--r-- 811 bytes parent folder | download | duplicates (3)
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

#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