|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * 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 $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
42 | 42 | #include "access/genam.h"
|
43 | 43 | #include "access/heapam.h"
|
44 | 44 | #include "catalog/heap.h"
|
| 45 | +#include "catalog/pg_type.h" |
45 | 46 |
|
46 | 47 | static Pointer
|
47 | 48 | ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
|
@@ -124,6 +125,31 @@ ExecOpenR(Oid relationOid, bool isindex)
|
124 | 125 | if (relation == NULL)
|
125 | 126 | elog(DEBUG, "ExecOpenR: relation == NULL, heap_open failed.");
|
126 | 127 |
|
| 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 | + } |
127 | 153 | return relation;
|
128 | 154 | }
|
129 | 155 |
|
|
0 commit comments