v1-0001-ERROR-failed-to-find-conversion-function-from-unknown-to-text.patch
text/x-patch
Filename: v1-0001-ERROR-failed-to-find-conversion-function-from-unknown-to-text.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: ERROR: failed to find conversion function from unknown to text
| File | + | − |
|---|---|---|
| src/backend/parser/parse_coerce.c | 10 | 0 |
From a497d39fdd4aca2db190b21153e19093adb3dec7 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Thu, 29 Jan 2026 09:10:02 +0800
Subject: [PATCH v1 1/1] ERROR: failed to find conversion function from
unknown to text
demo:
create table t(a text);
select cast(a as unknown) from t;
discussion: https://postgr.es/m/
---
src/backend/parser/parse_coerce.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 913ca53666f..68ac99e471c 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -411,6 +411,16 @@ coerce_type(ParseState *pstate, Node *node,
}
return result;
}
+
+ if (targetTypeId == UNKNOWNOID)
+ {
+ Oid inputBaseTypeId = getBaseType(inputTypeId);
+ TYPCATEGORY s_typcategory = TypeCategory(inputBaseTypeId);
+
+ if (s_typcategory == TYPCATEGORY_STRING)
+ return node;
+ }
+
pathtype = find_coercion_pathway(targetTypeId, inputTypeId, ccontext,
&funcId);
if (pathtype != COERCION_PATH_NONE)
--
2.34.1