Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
Description
Say we generate a RelNode corresponding to
SELECT CAST(c AS VARCHAR) FROM t
and we were to "unparse" that rel node back into the Postgres SQL dialect using
var converter = new RelToSqlConverter(PostgresqlSqlDialect.DEFAULT); SqlImplementor.Result result = converter.visitRoot(rel); SqlNode sqlNode = result.asStatement(); var sql = sqlNode.toSqlString(PostgresqlSqlDialect.DEFAULT).getSql();
it would generate something like:
SELECT CAST("c" AS VARCHAR) AS "c" FROM "t"
Note that there is no charset information included in the cast, since the PostgresSqlDialect specifies that it does not support char sets:
@Override public boolean supportsCharSet() { return false; }
Given that, we would expect that unparsing
SELECT CAST(c AS VARCHAR ARRAY) FROM t
back into SQL would also generate a type with no charset specified, but it in fact generates
SELECT CAST("c" AS VARCHAR CHARACTER SET "ISO-8859-1" ARRAY) AS "c" FROM "t"
This seems to come from the way `SqlTypeUtil.convertTypeToSpec()` handles collection types.
Attachments
Attachments
Issue Links
- links to