summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorRobert Haas2017-05-13 15:35:30 +0000
committerRobert Haas2017-05-13 15:36:41 +0000
commitf8bffe9e6d700fd34759a92e47930ce9ba7dcbd5 (patch)
tree154ac104bd6d5de35318b3cb77c098ab04eeeb7b /src/include
parent4e37b3e15c4e129dbbcf46e00ad36672f4f7b359 (diff)
Fix multi-column range partitioning constraints.
The old logic was just plain wrong. Report by Olaf Gawenda. Patch by Amit Langote, reviewed by Beena Emerson and by me. Minor adjustments by me also.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/pg_list.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h
index 9df7fb30d30..3313b051cec 100644
--- a/src/include/nodes/pg_list.h
+++ b/src/include/nodes/pg_list.h
@@ -183,6 +183,20 @@ list_length(const List *l)
(cell1) = lnext(cell1), (cell2) = lnext(cell2))
/*
+ * for_both_cell -
+ * a convenience macro which loops through two lists starting from the
+ * specified cells of each. This macro loops through both lists at the same
+ * time, stopping when either list runs out of elements. Depending on the
+ * requirements of the call site, it may also be wise to assert that the
+ * lengths of the two lists are equal, and initcell1 and initcell2 are at
+ * the same position in the respective lists.
+ */
+#define for_both_cell(cell1, initcell1, cell2, initcell2) \
+ for ((cell1) = (initcell1), (cell2) = (initcell2); \
+ (cell1) != NULL && (cell2) != NULL; \
+ (cell1) = lnext(cell1), (cell2) = lnext(cell2))
+
+/*
* forthree -
* the same for three lists
*/