summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-04-07 13:55:28 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-04-07 13:55:28 -0400
commit5d3853a7fa40b28b44b14084863fd83a188c9a9e (patch)
treefa0bd919f89eb3752f29cb1650f63a8d524fa5bb /src/include
parentda311c7dbe4e166df9246f1df9c8ed62faea81dc (diff)
Fix plpgsql's issues with dropped columns in rowtypes in 8.4 branch.
This is a back-patch of commit dcb2bda9b7042dbf43f876c94ebf35d951de10e9 of Aug 6 2009, which fixed assorted cases in which plpgsql would fail to cope with composite types that contain any dropped columns. Per discussion, this fix has been out in 9.0 for long enough to make it improbable that it creates any new bugs, so this is a low-risk fix. To make it even lower risk, I did not back-patch the changes in execQual.c, but just accepted the duplication of code between there and tupconvert.c. The added files tupconvert.h and tupconvert.c match their current states in HEAD.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/tupconvert.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/include/access/tupconvert.h b/src/include/access/tupconvert.h
new file mode 100644
index 00000000000..ab79f09fe81
--- /dev/null
+++ b/src/include/access/tupconvert.h
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ *
+ * tupconvert.h
+ * Tuple conversion support.
+ *
+ *
+ * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/tupconvert.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef TUPCONVERT_H
+#define TUPCONVERT_H
+
+#include "access/htup.h"
+
+
+typedef struct TupleConversionMap
+{
+ TupleDesc indesc; /* tupdesc for source rowtype */
+ TupleDesc outdesc; /* tupdesc for result rowtype */
+ AttrNumber *attrMap; /* indexes of input fields, or 0 for null */
+ Datum *invalues; /* workspace for deconstructing source */
+ bool *inisnull;
+ Datum *outvalues; /* workspace for constructing result */
+ bool *outisnull;
+} TupleConversionMap;
+
+
+extern TupleConversionMap *convert_tuples_by_position(TupleDesc indesc,
+ TupleDesc outdesc,
+ const char *msg);
+
+extern TupleConversionMap *convert_tuples_by_name(TupleDesc indesc,
+ TupleDesc outdesc,
+ const char *msg);
+
+extern HeapTuple do_convert_tuple(HeapTuple tuple, TupleConversionMap *map);
+
+extern void free_conversion_map(TupleConversionMap *map);
+
+#endif /* TUPCONVERT_H */