forked from timescale/timescaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_utils.h
More file actions
33 lines (30 loc) · 2.12 KB
/
error_utils.h
File metadata and controls
33 lines (30 loc) · 2.12 KB
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
/*
* This file and its contents are licensed under the Apache License 2.0.
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#pragma once
#define GETARG_NOTNULL_OID(var, arg, name) \
{ \
var = PG_ARGISNULL(arg) ? InvalidOid : PG_GETARG_OID(arg); \
if (!OidIsValid(var)) \
ereport(ERROR, \
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
errmsg("%s cannot be NULL", name))); \
}
#define GETARG_NOTNULL_POINTER(var, arg, name, type) \
{ \
if (PG_ARGISNULL(arg)) \
ereport(ERROR, \
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
errmsg("%s cannot be NULL", name))); \
var = (type *) PG_GETARG_POINTER(arg); \
}
#define GETARG_NOTNULL_NULLABLE(var, arg, name, type) \
{ \
if (PG_ARGISNULL(arg)) \
ereport(ERROR, \
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
errmsg("%s cannot be NULL", name))); \
var = PG_GETARG_##type(arg); \
}