• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Query Performance Optimization
  5. Troubleshooting Errors Using SQL Statements
  6. 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

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;