From d7427e4802fd4d7108e37544115cab83c13172ab Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 16 Jan 1998 05:03:45 +0000
Subject: [PATCH] Temporary varchar patch.

---
 src/backend/executor/execAmi.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 4f76237b0b2..675a58d649f 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.14 1998/01/07 21:02:36 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.15 1998/01/16 05:03:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,6 +42,7 @@
 #include "access/genam.h"
 #include "access/heapam.h"
 #include "catalog/heap.h"
+#include "catalog/pg_type.h"
 
 static Pointer
 ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
@@ -124,6 +125,31 @@ ExecOpenR(Oid relationOid, bool isindex)
 	if (relation == NULL)
 		elog(DEBUG, "ExecOpenR: relation == NULL, heap_open failed.");
 
+	{
+		int i;
+		Relation trel = palloc(sizeof(RelationData));
+		TupleDesc tdesc = palloc(sizeof(struct tupleDesc));
+		AttributeTupleForm *tatt =
+				palloc(sizeof(AttributeTupleForm*)*relation->rd_att->natts);
+
+		memcpy(trel, relation, sizeof(RelationData));
+		memcpy(tdesc, relation->rd_att, sizeof(struct tupleDesc));
+		trel->rd_att = tdesc;
+		tdesc->attrs = tatt;
+		
+		for (i = 0; i < relation->rd_att->natts; i++)
+		{
+			if (relation->rd_att->attrs[i]->atttypid != VARCHAROID)
+				tdesc->attrs[i] = relation->rd_att->attrs[i];
+			else
+			{
+				tdesc->attrs[i] = palloc(sizeof(FormData_pg_attribute));
+				memcpy(tdesc->attrs[i], relation->rd_att->attrs[i],
+											sizeof(FormData_pg_attribute));
+				tdesc->attrs[i]->attlen = -1;
+			}
+		}
+	}
 	return relation;
 }
 
-- 
GitLab