> I'll go ahead and commit the code tonight or tomorrow...
OK, I committed the patches. They fix the
SELECT NULL ORDER BY 1
query problem, but do assign types for cases where they aren't assigned
in the transformSortClause() procedure so may touch what David is
doing??
Patch enclosed, but the cvs tree already has it too.
- Tom
*** parse_clause.c.orig Sat Jul 11 15:16:44 1998
--- parse_clause.c Wed Jul 15 16:59:59 1998
***************
*** 317,322 ****
--- 317,326 ----
{
List *s = NIL;
+ #ifdef PARSEDEBUG
+ printf("transformSortClause: entering\n");
+ #endif
+
while (orderlist != NIL)
{
SortGroupBy *sortby = lfirst(orderlist);
***************
*** 326,332 ****
--- 330,346 ----
restarget = find_targetlist_entry(pstate, sortby, targetlist);
+ #ifdef PARSEDEBUG
+ printf("transformSortClause: find sorting operator for type %d\n",
+ restarget->resdom->restype);
+ #endif
+
sortcl->resdom = resdom = restarget->resdom;
+
+ /* if we have InvalidOid, then this is a NULL field and don't need to sort */
+ if (resdom->restype == InvalidOid)
+ resdom->restype = INT4OID;
+
sortcl->opoid = oprid(oper(sortby->useOp,
resdom->restype,
resdom->restype, false));
***************
*** 389,394 ****
--- 403,416 ----
/* not a member of the sortclauses yet */
SortClause *sortcl = makeNode(SortClause);
+ #ifdef PARSEDEBUG
+ printf("transformSortClause: (2) find sorting operator for type %d\n",
+ tlelt->resdom->restype);
+ #endif
+
+ if (tlelt->resdom->restype == InvalidOid)
+ tlelt->resdom->restype = INT4OID;
+
sortcl->resdom = tlelt->resdom;
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
***************
*** 423,428 ****
--- 445,455 ----
/* not a member of the sortclauses yet */
SortClause *sortcl = makeNode(SortClause);
+ #ifdef PARSEDEBUG
+ printf("transformSortClause: try sorting type %d\n",
+ tlelt->resdom->restype);
+ #endif
+
sortcl->resdom = tlelt->resdom;
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
***************
*** 485,490 ****
--- 512,524 ----
{
((TargetEntry *)lfirst(prev_target))->resdom->restype = itype;
}
+ #if FALSE
+ else
+ {
+ ((TargetEntry *)lfirst(prev_target))->resdom->restype = UNKNOWNOID;
+ ((TargetEntry *)lfirst(next_target))->resdom->restype = UNKNOWNOID;
+ }
+ #endif
}
else if (itype == InvalidOid)
{