summaryrefslogtreecommitdiff
path: root/src/backend/access/common/indextuple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/common/indextuple.c')
-rw-r--r--src/backend/access/common/indextuple.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index cd3b88654bd..a49ec34a040 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.88 2009/06/11 14:48:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.89 2009/08/01 19:59:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -433,6 +433,27 @@ nocache_index_getattr(IndexTuple tup,
}
/*
+ * Convert an index tuple into Datum/isnull arrays.
+ *
+ * The caller must allocate sufficient storage for the output arrays.
+ * (INDEX_MAX_KEYS entries should be enough.)
+ */
+void
+index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
+ Datum *values, bool *isnull)
+{
+ int i;
+
+ /* Assert to protect callers who allocate fixed-size arrays */
+ Assert(tupleDescriptor->natts <= INDEX_MAX_KEYS);
+
+ for (i = 0; i < tupleDescriptor->natts; i++)
+ {
+ values[i] = index_getattr(tup, i + 1, tupleDescriptor, &isnull[i]);
+ }
+}
+
+/*
* Create a palloc'd copy of an index tuple.
*/
IndexTuple