Skip to content

Commit d7427e4

Browse files
committed
Temporary varchar patch.
1 parent 41a4f64 commit d7427e4

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/backend/executor/execAmi.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.14 1998/01/07 21:02:36 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.15 1998/01/16 05:03:45 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -42,6 +42,7 @@
4242
#include "access/genam.h"
4343
#include "access/heapam.h"
4444
#include "catalog/heap.h"
45+
#include "catalog/pg_type.h"
4546

4647
static Pointer
4748
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
@@ -124,6 +125,31 @@ ExecOpenR(Oid relationOid, bool isindex)
124125
if (relation == NULL)
125126
elog(DEBUG, "ExecOpenR: relation == NULL, heap_open failed.");
126127

128+
{
129+
int i;
130+
Relation trel = palloc(sizeof(RelationData));
131+
TupleDesc tdesc = palloc(sizeof(struct tupleDesc));
132+
AttributeTupleForm *tatt =
133+
palloc(sizeof(AttributeTupleForm*)*relation->rd_att->natts);
134+
135+
memcpy(trel, relation, sizeof(RelationData));
136+
memcpy(tdesc, relation->rd_att, sizeof(struct tupleDesc));
137+
trel->rd_att = tdesc;
138+
tdesc->attrs = tatt;
139+
140+
for (i = 0; i < relation->rd_att->natts; i++)
141+
{
142+
if (relation->rd_att->attrs[i]->atttypid != VARCHAROID)
143+
tdesc->attrs[i] = relation->rd_att->attrs[i];
144+
else
145+
{
146+
tdesc->attrs[i] = palloc(sizeof(FormData_pg_attribute));
147+
memcpy(tdesc->attrs[i], relation->rd_att->attrs[i],
148+
sizeof(FormData_pg_attribute));
149+
tdesc->attrs[i]->attlen = -1;
150+
}
151+
}
152+
}
127153
return relation;
128154
}
129155

0 commit comments

Comments
 (0)