aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/amvalidate.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-01-21 19:47:15 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-01-21 19:47:15 -0500
commitbe44ed27b86ebd165bbedf06a4ac5a8eb943d43c (patch)
treea8371a5b5e3052dbb3b3118c24956f67c9d3b591 /src/include/access/amvalidate.h
parentb99551832e79c915e4d877cf0a072120bd248748 (diff)
downloadpostgresql-be44ed27b86ebd165bbedf06a4ac5a8eb943d43c.tar.gz
postgresql-be44ed27b86ebd165bbedf06a4ac5a8eb943d43c.zip
Improve index AMs' opclass validation procedures.
The amvalidate functions added in commit 65c5fcd353a859da were on the crude side. Improve them in a few ways: * Perform signature checking for operators and support functions. * Apply more thorough checks for missing operators and functions, where possible. * Instead of reporting problems as ERRORs, report most problems as INFO messages and make the amvalidate function return FALSE. This allows more than one problem to be discovered per run. * Report object names rather than OIDs, and work a bit harder on making the messages understandable. Also, remove a few more opr_sanity regression test queries that are now superseded by the amvalidate checks.
Diffstat (limited to 'src/include/access/amvalidate.h')
-rw-r--r--src/include/access/amvalidate.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/include/access/amvalidate.h b/src/include/access/amvalidate.h
new file mode 100644
index 00000000000..7f4289a9960
--- /dev/null
+++ b/src/include/access/amvalidate.h
@@ -0,0 +1,36 @@
+/*-------------------------------------------------------------------------
+ *
+ * amvalidate.h
+ * Support routines for index access methods' amvalidate functions.
+ *
+ * Copyright (c) 2016, PostgreSQL Global Development Group
+ *
+ * src/include/access/amvalidate.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef AMVALIDATE_H
+#define AMVALIDATE_H
+
+#include "utils/catcache.h"
+
+
+/* Struct returned (in a list) by identify_opfamily_groups() */
+typedef struct OpFamilyOpFuncGroup
+{
+ Oid lefttype; /* amoplefttype/amproclefttype */
+ Oid righttype; /* amoprighttype/amprocrighttype */
+ uint64 operatorset; /* bitmask of operators with these types */
+ uint64 functionset; /* bitmask of support funcs with these types */
+} OpFamilyOpFuncGroup;
+
+
+/* Functions in access/index/amvalidate.c */
+extern List *identify_opfamily_groups(CatCList *oprlist, CatCList *proclist);
+extern bool check_amproc_signature(Oid funcid, Oid restype, bool exact,
+ int minargs, int maxargs,...);
+extern bool check_amop_signature(Oid opno, Oid restype,
+ Oid lefttype, Oid righttype);
+extern bool opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid);
+
+#endif /* AMVALIDATE_H */