88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.112 2003/11/29 19:51:52 pgsql Exp $
11+ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.113 2003/12/17 19:49:39 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -153,6 +153,14 @@ coerce_type(ParseState *pstate, Node *node,
153153/* no conversion needed */
154154return node ;
155155}
156+ if (targetTypeId == ANYOID ||
157+ targetTypeId == ANYARRAYOID ||
158+ targetTypeId == ANYELEMENTOID )
159+ {
160+ /* assume can_coerce_type verified that implicit coercion is okay */
161+ /* NB: we do NOT want a RelabelType here */
162+ return node ;
163+ }
156164if (inputTypeId == UNKNOWNOID && IsA (node ,Const ))
157165{
158166/*
@@ -260,14 +268,6 @@ coerce_type(ParseState *pstate, Node *node,
260268param -> paramtype = targetTypeId ;
261269return (Node * )param ;
262270}
263- if (targetTypeId == ANYOID ||
264- targetTypeId == ANYARRAYOID ||
265- targetTypeId == ANYELEMENTOID )
266- {
267- /* assume can_coerce_type verified that implicit coercion is okay */
268- /* NB: we do NOT want a RelabelType here */
269- return node ;
270- }
271271if (find_coercion_pathway (targetTypeId ,inputTypeId ,ccontext ,
272272& funcId ))
273273{
@@ -372,17 +372,6 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
372372if (!typeidIsValid (targetTypeId ))
373373return false;
374374
375- /*
376- * If input is an untyped string constant, assume we can convert
377- * it to anything except a class type.
378- */
379- if (inputTypeId == UNKNOWNOID )
380- {
381- if (ISCOMPLEX (targetTypeId ))
382- return false;
383- continue ;
384- }
385-
386375/* accept if target is ANY */
387376if (targetTypeId == ANYOID )
388377continue ;
@@ -395,6 +384,17 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
395384continue ;
396385}
397386
387+ /*
388+ * If input is an untyped string constant, assume we can convert
389+ * it to anything except a class type.
390+ */
391+ if (inputTypeId == UNKNOWNOID )
392+ {
393+ if (ISCOMPLEX (targetTypeId ))
394+ return false;
395+ continue ;
396+ }
397+
398398/*
399399 * If pg_cast shows that we can coerce, accept. This test now
400400 * covers both binary-compatible and coercion-function cases.