|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.22 2007/01/05 22:19:27 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.23 2007/01/10 18:06:02 tgl Exp $ |
12 | 12 | * |
13 | 13 | *------------------------------------------------------------------------- |
14 | 14 | */ |
@@ -183,65 +183,56 @@ execTuplesUnequal(TupleTableSlot *slot1, |
183 | 183 | * The result is a palloc'd array. |
184 | 184 | */ |
185 | 185 | FmgrInfo * |
186 | | -execTuplesMatchPrepare(TupleDesc tupdesc, |
187 | | - int numCols, |
188 | | - AttrNumber *matchColIdx) |
| 186 | +execTuplesMatchPrepare(int numCols, |
| 187 | + Oid *eqOperators) |
189 | 188 | { |
190 | | - FmgrInfo *eqfunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
| 189 | + FmgrInfo *eqFunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
191 | 190 | int i; |
192 | 191 |
|
193 | 192 | for (i = 0; i < numCols; i++) |
194 | 193 | { |
195 | | - AttrNumber att = matchColIdx[i]; |
196 | | - Oid typid = tupdesc->attrs[att - 1]->atttypid; |
| 194 | + Oid eq_opr = eqOperators[i]; |
197 | 195 | Oid eq_function; |
198 | 196 |
|
199 | | - eq_function = equality_oper_funcid(typid); |
200 | | - fmgr_info(eq_function, &eqfunctions[i]); |
| 197 | + eq_function = get_opcode(eq_opr); |
| 198 | + fmgr_info(eq_function, &eqFunctions[i]); |
201 | 199 | } |
202 | 200 |
|
203 | | - return eqfunctions; |
| 201 | + return eqFunctions; |
204 | 202 | } |
205 | 203 |
|
206 | 204 | /* |
207 | 205 | * execTuplesHashPrepare |
208 | 206 | * Look up the equality and hashing functions needed for a TupleHashTable. |
209 | 207 | * |
210 | 208 | * This is similar to execTuplesMatchPrepare, but we also need to find the |
211 | | - * hash functions associated with the equality operators. *eqfunctions and |
212 | | - * *hashfunctions receive the palloc'd result arrays. |
| 209 | + * hash functions associated with the equality operators. *eqFunctions and |
| 210 | + * *hashFunctions receive the palloc'd result arrays. |
213 | 211 | */ |
214 | 212 | void |
215 | | -execTuplesHashPrepare(TupleDesc tupdesc, |
216 | | - int numCols, |
217 | | - AttrNumber *matchColIdx, |
218 | | - FmgrInfo **eqfunctions, |
219 | | - FmgrInfo **hashfunctions) |
| 213 | +execTuplesHashPrepare(int numCols, |
| 214 | + Oid *eqOperators, |
| 215 | + FmgrInfo **eqFunctions, |
| 216 | + FmgrInfo **hashFunctions) |
220 | 217 | { |
221 | 218 | int i; |
222 | 219 |
|
223 | | - *eqfunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
224 | | - *hashfunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
| 220 | + *eqFunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
| 221 | + *hashFunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
225 | 222 |
|
226 | 223 | for (i = 0; i < numCols; i++) |
227 | 224 | { |
228 | | - AttrNumber att = matchColIdx[i]; |
229 | | - Oid typid = tupdesc->attrs[att - 1]->atttypid; |
230 | | - Operator optup; |
231 | | - Oid eq_opr; |
| 225 | + Oid eq_opr = eqOperators[i]; |
232 | 226 | Oid eq_function; |
233 | 227 | Oid hash_function; |
234 | 228 |
|
235 | | - optup = equality_oper(typid, false); |
236 | | - eq_opr = oprid(optup); |
237 | | - eq_function = oprfuncid(optup); |
238 | | - ReleaseSysCache(optup); |
| 229 | + eq_function = get_opcode(eq_opr); |
239 | 230 | hash_function = get_op_hash_function(eq_opr); |
240 | 231 | if (!OidIsValid(hash_function)) /* should not happen */ |
241 | 232 | elog(ERROR, "could not find hash function for hash operator %u", |
242 | 233 | eq_opr); |
243 | | - fmgr_info(eq_function, &(*eqfunctions)[i]); |
244 | | - fmgr_info(hash_function, &(*hashfunctions)[i]); |
| 234 | + fmgr_info(eq_function, &(*eqFunctions)[i]); |
| 235 | + fmgr_info(hash_function, &(*hashFunctions)[i]); |
245 | 236 | } |
246 | 237 | } |
247 | 238 |
|
|
0 commit comments