summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/parse_coerce.c7
-rw-r--r--src/backend/parser/parse_func.c11
2 files changed, 11 insertions, 7 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index c0081133eb3..4870b24de07 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.84 2002/09/18 21:35:22 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.85 2002/10/24 22:09:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,9 +32,6 @@ static Node *coerce_type_typmod(Node *node,
Oid targetTypeId, int32 targetTypMod,
CoercionForm cformat);
static Oid PreferredType(CATEGORY category, Oid type);
-static bool find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
- CoercionContext ccontext,
- Oid *funcid);
static Node *build_func_call(Oid funcid, Oid rettype, List *args,
CoercionForm fformat);
@@ -910,7 +907,7 @@ IsBinaryCoercible(Oid srctype, Oid targettype)
* to the castfunc value (which may be InvalidOid for a binary-compatible
* coercion).
*/
-static bool
+bool
find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
CoercionContext ccontext,
Oid *funcid)
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 6c194f06c5b..9bd0e2f814b 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.138 2002/10/19 21:23:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.139 2002/10/24 22:09:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -770,6 +770,11 @@ func_get_detail(List *funcname,
* and ones that are coercing a previously-unknown-type literal
* constant to a specific type.
*
+ * The reason we can restrict our check to binary-compatible
+ * coercions here is that we expect non-binary-compatible coercions
+ * to have an implementation function named after the target type.
+ * That function will be found by normal lookup if appropriate.
+ *
* NB: it's important that this code stays in sync with what
* coerce_type can do, because the caller will try to apply
* coerce_type if we return FUNCDETAIL_COERCION. If we return
@@ -791,7 +796,9 @@ func_get_detail(List *funcname,
Node *arg1 = lfirst(fargs);
if ((sourceType == UNKNOWNOID && IsA(arg1, Const)) ||
- IsBinaryCoercible(sourceType, targetType))
+ (find_coercion_pathway(targetType, sourceType,
+ COERCION_EXPLICIT, funcid) &&
+ *funcid == InvalidOid))
{
/* Yup, it's a type coercion */
*funcid = InvalidOid;