8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -153,6 +153,14 @@ coerce_type(ParseState *pstate, Node *node,
153
153
/* no conversion needed */
154
154
return node ;
155
155
}
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
+ }
156
164
if (inputTypeId == UNKNOWNOID && IsA (node , Const ))
157
165
{
158
166
/*
@@ -260,14 +268,6 @@ coerce_type(ParseState *pstate, Node *node,
260
268
param -> paramtype = targetTypeId ;
261
269
return (Node * ) param ;
262
270
}
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
- }
271
271
if (find_coercion_pathway (targetTypeId , inputTypeId , ccontext ,
272
272
& funcId ))
273
273
{
@@ -372,17 +372,6 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
372
372
if (!typeidIsValid (targetTypeId ))
373
373
return false;
374
374
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
-
386
375
/* accept if target is ANY */
387
376
if (targetTypeId == ANYOID )
388
377
continue ;
@@ -395,6 +384,17 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
395
384
continue ;
396
385
}
397
386
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
+
398
398
/*
399
399
* If pg_cast shows that we can coerce, accept. This test now
400
400
* covers both binary-compatible and coercion-function cases.
0 commit comments