Help Center > > Developer Guide> Query Performance Optimization> Troubleshooting Errors Using SQL Statements> "failed to find conversion function from unknown to text" Is Displayed When a User Executes the SELECT Statement

"failed to find conversion function from unknown to text" Is Displayed When a User Executes the SELECT Statement

Updated at: May 15, 2019 GMT+08:00

Description

An error message is displayed when the SELECT statement is executed.

failed to find conversion function from unknown to text

ERROR:  failed to find conversion function from unknown to text

Possible Causes

The type of a constant in a subquery of the SELECT statement is not specified.

Troubleshooting Method

Convert the constant type of the subquery to a fixed type.

Example:

create table t1(col1 int, col2 int);

SELECT distinct Q.*
    FROM (SELECT col1,
          '2015-03-01' AS start_time,
          '2015-03-01' AS last_time
         FROM t1)Q;

Change it as follows:

SELECT distinct Q.*
    FROM (SELECT col1,
          cast('2015-03-01' as text) AS start_time,
          cast('2015-03-01' as text) AS last_time
         FROM t1)Q;

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel