- Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathcompat.h
50 lines (45 loc) · 1.25 KB
/
compat.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
/*
* compat.h
* Definitions for function wrappers compatible between PG versions.
*
* Copyright (c) 2015-2025, Postgres Professional
*
* IDENTIFICATION
* contrib/pg_wait_sampling/compat.h
*/
#ifndef__COMPAT_H__
#define__COMPAT_H__
#include"miscadmin.h"
#include"storage/shm_mq.h"
staticinlineshm_mq_result
shm_mq_send_compat(shm_mq_handle*mqh, Sizenbytes, constvoid*data,
boolnowait, boolforce_flush)
{
#ifPG_VERSION_NUM >= 150000
returnshm_mq_send(mqh, nbytes, data, nowait, force_flush);
#else
returnshm_mq_send(mqh, nbytes, data, nowait);
#endif
}
#ifPG_VERSION_NUM<170000
#defineINIT_PG_LOAD_SESSION_LIBS 0x0001
#defineINIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
#endif
staticinlinevoid
InitPostgresCompat(constchar*in_dbname, Oiddboid,
constchar*username, Oiduseroid,
bits32flags,
char*out_dbname)
{
#ifPG_VERSION_NUM >= 170000
InitPostgres(in_dbname, dboid, username, useroid, flags, out_dbname);
#elifPG_VERSION_NUM >= 150000
InitPostgres(in_dbname, dboid, username, useroid,
flags&INIT_PG_LOAD_SESSION_LIBS,
flags&INIT_PG_OVERRIDE_ALLOW_CONNS, out_dbname);
#else
InitPostgres(in_dbname, dboid, username, useroid, out_dbname,
flags&INIT_PG_OVERRIDE_ALLOW_CONNS);
#endif
}
#endif