8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.108 2009/06/11 14:49:00 momjian Exp $
11
+ * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.109 2009/06/13 15:42:09 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -203,7 +203,7 @@ get_sort_group_operators(Oid argtype,
203
203
* If the datatype is an array, then we can use array_lt and friends ...
204
204
* but only if there are suitable operators for the element type. (This
205
205
* check is not in the raw typcache.c code ... should it be?) Testing all
206
- * three operator IDs here should be redundant.
206
+ * three operator IDs here should be redundant, but let's do it anyway .
207
207
*/
208
208
if (lt_opr == ARRAY_LT_OP ||
209
209
eq_opr == ARRAY_EQ_OP ||
@@ -215,12 +215,31 @@ get_sort_group_operators(Oid argtype,
215
215
{
216
216
typentry = lookup_type_cache (elem_type ,
217
217
TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR );
218
- if (! OidIsValid ( typentry -> lt_opr ))
219
- lt_opr = InvalidOid ; /* element type has no "<" */
218
+ #ifdef NOT_USED
219
+ /* We should do this ... */
220
220
if (!OidIsValid (typentry -> eq_opr ))
221
- eq_opr = InvalidOid ; /* element type has no "=" */
222
- if (!OidIsValid (typentry -> gt_opr ))
223
- gt_opr = InvalidOid ; /* element type has no ">" */
221
+ {
222
+ /* element type is neither sortable nor hashable */
223
+ lt_opr = eq_opr = gt_opr = InvalidOid ;
224
+ }
225
+ else if (!OidIsValid (typentry -> lt_opr ) ||
226
+ !OidIsValid (typentry -> gt_opr ))
227
+ {
228
+ /* element type is hashable but not sortable */
229
+ lt_opr = gt_opr = InvalidOid ;
230
+ }
231
+ #else
232
+ /*
233
+ * ... but for the moment we have to do this. This is because
234
+ * anyarray has sorting but not hashing support. So, if the
235
+ * element type is only hashable, there is nothing we can do
236
+ * with the array type.
237
+ */
238
+ if (!OidIsValid (typentry -> lt_opr ) ||
239
+ !OidIsValid (typentry -> eq_opr ) ||
240
+ !OidIsValid (typentry -> gt_opr ))
241
+ lt_opr = eq_opr = gt_opr = InvalidOid ; /* not sortable */
242
+ #endif
224
243
}
225
244
else
226
245
lt_opr = eq_opr = gt_opr = InvalidOid ; /* bogus array type? */
0 commit comments