7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.13 1999/05/19 16:46:12 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.14 1999/05/22 02:55:57 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -41,18 +41,8 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId)
41
41
Oid infunc ;
42
42
Datum val ;
43
43
44
- #ifdef PARSEDEBUG
45
- printf ("coerce_type: argument types are %d -> %u\n" ,
46
- inputTypeId , targetTypeId );
47
- #endif
48
-
49
44
if (targetTypeId == InvalidOid )
50
- {
51
- #ifdef PARSEDEBUG
52
- printf ("coerce_type: apparent NULL target argument; suppress type conversion\n" );
53
- #endif
54
45
result = node ;
55
- }
56
46
else if (inputTypeId != targetTypeId )
57
47
{
58
48
@@ -61,13 +51,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId)
61
51
* through...
62
52
*/
63
53
if (IS_BINARY_COMPATIBLE (inputTypeId , targetTypeId ))
64
- {
65
- #ifdef PARSEDEBUG
66
- printf ("coerce_type: argument type %s is known to be convertible to type %s\n" ,
67
- typeidTypeName (inputTypeId ), typeidTypeName (targetTypeId ));
68
- #endif
69
54
result = node ;
70
- }
71
55
72
56
/*
73
57
* if not unknown input type, try for explicit conversion using
@@ -84,18 +68,10 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId)
84
68
n -> funcname = typeidTypeName (targetTypeId );
85
69
n -> args = lcons (node , NIL );
86
70
87
- #ifdef PARSEDEBUG
88
- printf ("coerce_type: construct function %s(%s)\n" ,
89
- typeidTypeName (targetTypeId ), typeidTypeName (inputTypeId ));
90
- #endif
91
-
92
71
result = transformExpr (pstate , (Node * ) n , EXPR_COLUMN_FIRST );
93
72
}
94
73
else
95
74
{
96
- #ifdef PARSEDEBUG
97
- printf ("coerce_type: node is UNKNOWN type\n" );
98
- #endif
99
75
if (nodeTag (node ) == T_Const )
100
76
{
101
77
Const * con = (Const * ) node ;
@@ -117,22 +93,11 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId)
117
93
result = (Node * ) con ;
118
94
}
119
95
else
120
- {
121
- #ifdef PARSEDEBUG
122
- printf ("coerce_type: should never get here!\n" );
123
- #endif
124
96
result = node ;
125
- }
126
97
}
127
98
}
128
99
else
129
- {
130
- #ifdef PARSEDEBUG
131
- printf ("coerce_type: argument type IDs %u match\n" , inputTypeId );
132
- #endif
133
-
134
100
result = node ;
135
- }
136
101
137
102
return result ;
138
103
} /* coerce_type() */
@@ -163,10 +128,6 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
163
128
/* run through argument list... */
164
129
for (i = 0 ; i < nargs ; i ++ )
165
130
{
166
- #ifdef PARSEDEBUG
167
- printf ("can_coerce_type: argument #%d types are %u -> %u\n" ,
168
- i , input_typeids [i ], func_typeids [i ]);
169
- #endif
170
131
if (input_typeids [i ] != func_typeids [i ])
171
132
{
172
133
@@ -175,31 +136,14 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
175
136
* through...
176
137
*/
177
138
if (IS_BINARY_COMPATIBLE (input_typeids [i ], func_typeids [i ]))
178
- {
179
- #ifdef PARSEDEBUG
180
- printf ("can_coerce_type: argument #%d type %s is known to be convertible to type %s\n" ,
181
- i , typeidTypeName (input_typeids [i ]), typeidTypeName (func_typeids [i ]));
182
- #endif
183
- }
139
+ ;
184
140
185
141
/* don't know what to do for the output type? then quit... */
186
142
else if (func_typeids [i ] == InvalidOid )
187
- {
188
- #ifdef PARSEDEBUG
189
- printf ("can_coerce_type: output OID func_typeids[%u] is zero\n" , i );
190
- #endif
191
143
return false;
192
- }
193
-
194
144
/* don't know what to do for the input type? then quit... */
195
145
else if (input_typeids [i ] == InvalidOid )
196
- {
197
- #ifdef PARSEDEBUG
198
- printf ("can_coerce_type: input OID input_typeids[%u] is zero\n" , i );
199
- #endif
200
146
return false;
201
- }
202
-
203
147
/*
204
148
* if not unknown input type, try for explicit conversion
205
149
* using functions...
@@ -223,51 +167,13 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids)
223
167
* should also check the function return type just to be
224
168
* safe...
225
169
*/
226
- if (HeapTupleIsValid (ftup ))
227
- {
228
- #ifdef PARSEDEBUG
229
- printf ("can_coerce_type: found function %s(%s) to convert argument #%d\n" ,
230
- typeidTypeName (func_typeids [i ]), typeidTypeName (input_typeids [i ]), i );
231
- #endif
232
- }
233
- else
234
- {
235
- #ifdef PARSEDEBUG
236
- printf ("can_coerce_type: did not find function %s(%s) to convert argument #%d\n" ,
237
- typeidTypeName (func_typeids [i ]), typeidTypeName (input_typeids [i ]), i );
238
- #endif
170
+ if (!HeapTupleIsValid (ftup ))
239
171
return false;
240
- }
241
- }
242
- else
243
- {
244
- #ifdef PARSEDEBUG
245
- printf ("can_coerce_type: argument #%d type is %u (UNKNOWN)\n" ,
246
- i , input_typeids [i ]);
247
- #endif
248
172
}
249
173
250
174
tp = typeidType (input_typeids [i ]);
251
175
if (typeTypeFlag (tp ) == 'c' )
252
- {
253
- #ifdef PARSEDEBUG
254
- printf ("can_coerce_type: typeTypeFlag for %s is 'c'\n" ,
255
- typeidTypeName (input_typeids [i ]));
256
- #endif
257
176
return false;
258
- }
259
-
260
- #ifdef PARSEDEBUG
261
- printf ("can_coerce_type: conversion from %s to %s is possible\n" ,
262
- typeidTypeName (input_typeids [i ]), typeidTypeName (func_typeids [i ]));
263
- #endif
264
- }
265
- else
266
- {
267
- #ifdef PARSEDEBUG
268
- printf ("can_coerce_type: argument #%d type IDs %u match\n" ,
269
- i , input_typeids [i ]);
270
- #endif
271
177
}
272
178
}
273
179
@@ -396,9 +302,6 @@ PreferredType(CATEGORY category, Oid type)
396
302
result = UNKNOWNOID ;
397
303
break ;
398
304
}
399
- #ifdef PARSEDEBUG
400
- printf ("PreferredType- (%d) preferred type is %s\n" , category , typeidTypeName (result ));
401
- #endif
402
305
return result ;
403
306
} /* PreferredType() */
404
307
0 commit comments