*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.34 1999/05/17 18:22:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.35 1999/05/22 02:55:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Attr *rattr = makeAttr(rname, i->name);
A_Expr *e = makeNode(A_Expr);
-#ifdef PARSEDEBUG
-printf("transformUsingClause- transform %s", nodeToString(i));
-#endif
-
e->oper = OP;
e->opname = "=";
e->lexpr = (Node *)lattr;
{
expr = (A_Expr *)qual;
}
-
-#ifdef PARSEDEBUG
-printf("transformUsingClause- transform %s", nodeToString(qual));
-#endif
-
}
-
-#ifdef PARSEDEBUG
-printf(" to %s\n", nodeToString(expr));
-#endif
}
return ((Node *)transformExpr(pstate, (Node *)expr, EXPR_COLUMN_FIRST));
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.13 1999/05/19 16:46:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.14 1999/05/22 02:55:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Oid infunc;
Datum val;
-#ifdef PARSEDEBUG
- printf("coerce_type: argument types are %d -> %u\n",
- inputTypeId, targetTypeId);
-#endif
-
if (targetTypeId == InvalidOid)
- {
-#ifdef PARSEDEBUG
- printf("coerce_type: apparent NULL target argument; suppress type conversion\n");
-#endif
result = node;
- }
else if (inputTypeId != targetTypeId)
{
* through...
*/
if (IS_BINARY_COMPATIBLE(inputTypeId, targetTypeId))
- {
-#ifdef PARSEDEBUG
- printf("coerce_type: argument type %s is known to be convertible to type %s\n",
- typeidTypeName(inputTypeId), typeidTypeName(targetTypeId));
-#endif
result = node;
- }
/*
* if not unknown input type, try for explicit conversion using
n->funcname = typeidTypeName(targetTypeId);
n->args = lcons(node, NIL);
-#ifdef PARSEDEBUG
- printf("coerce_type: construct function %s(%s)\n",
- typeidTypeName(targetTypeId), typeidTypeName(inputTypeId));
-#endif
-
result = transformExpr(pstate, (Node *) n, EXPR_COLUMN_FIRST);
}
else
{
-#ifdef PARSEDEBUG
- printf("coerce_type: node is UNKNOWN type\n");
-#endif
if (nodeTag(node) == T_Const)
{
Const *con = (Const *) node;
result = (Node *) con;
}
else
- {
-#ifdef PARSEDEBUG
- printf("coerce_type: should never get here!\n");
-#endif
result = node;
- }
}
}
else
- {
-#ifdef PARSEDEBUG
- printf("coerce_type: argument type IDs %u match\n", inputTypeId);
-#endif
-
result = node;
- }
return result;
} /* coerce_type() */
/* run through argument list... */
for (i = 0; i < nargs; i++)
{
-#ifdef PARSEDEBUG
- printf("can_coerce_type: argument #%d types are %u -> %u\n",
- i, input_typeids[i], func_typeids[i]);
-#endif
if (input_typeids[i] != func_typeids[i])
{
* through...
*/
if (IS_BINARY_COMPATIBLE(input_typeids[i], func_typeids[i]))
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: argument #%d type %s is known to be convertible to type %s\n",
- i, typeidTypeName(input_typeids[i]), typeidTypeName(func_typeids[i]));
-#endif
- }
+ ;
/* don't know what to do for the output type? then quit... */
else if (func_typeids[i] == InvalidOid)
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: output OID func_typeids[%u] is zero\n", i);
-#endif
return false;
- }
-
/* don't know what to do for the input type? then quit... */
else if (input_typeids[i] == InvalidOid)
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: input OID input_typeids[%u] is zero\n", i);
-#endif
return false;
- }
-
/*
* if not unknown input type, try for explicit conversion
* using functions...
* should also check the function return type just to be
* safe...
*/
- if (HeapTupleIsValid(ftup))
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: found function %s(%s) to convert argument #%d\n",
- typeidTypeName(func_typeids[i]), typeidTypeName(input_typeids[i]), i);
-#endif
- }
- else
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: did not find function %s(%s) to convert argument #%d\n",
- typeidTypeName(func_typeids[i]), typeidTypeName(input_typeids[i]), i);
-#endif
+ if (!HeapTupleIsValid(ftup))
return false;
- }
- }
- else
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: argument #%d type is %u (UNKNOWN)\n",
- i, input_typeids[i]);
-#endif
}
tp = typeidType(input_typeids[i]);
if (typeTypeFlag(tp) == 'c')
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: typeTypeFlag for %s is 'c'\n",
- typeidTypeName(input_typeids[i]));
-#endif
return false;
- }
-
-#ifdef PARSEDEBUG
- printf("can_coerce_type: conversion from %s to %s is possible\n",
- typeidTypeName(input_typeids[i]), typeidTypeName(func_typeids[i]));
-#endif
- }
- else
- {
-#ifdef PARSEDEBUG
- printf("can_coerce_type: argument #%d type IDs %u match\n",
- i, input_typeids[i]);
-#endif
}
}
result = UNKNOWNOID;
break;
}
-#ifdef PARSEDEBUG
- printf("PreferredType- (%d) preferred type is %s\n", category, typeidTypeName(result));
-#endif
return result;
} /* PreferredType() */