summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/misc.c')
-rw-r--r--src/backend/utils/adt/misc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 7cb7716e58b..fa1cb675027 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -186,6 +186,20 @@ pg_num_nonnulls(PG_FUNCTION_ARGS)
PG_RETURN_INT32(nargs - nulls);
}
+/*
+ * error_on_null()
+ * Check if the input is the NULL value
+ */
+Datum
+pg_error_on_null(PG_FUNCTION_ARGS)
+{
+ if (PG_ARGISNULL(0))
+ ereport(ERROR,
+ (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
+ errmsg("null value not allowed")));
+
+ PG_RETURN_DATUM(PG_GETARG_DATUM(0));
+}
/*
* current_database()