[ https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Muhammad Gelbana closed CALCITE-3108. ------------------------------------- Resolution: Won't Fix Users can define their own types but the problem seems with the returned column type name. The metadata for the returned resultset for that query using calcite won't return the user-defiend type alias for the column type name, it will return whatever the user-define type was configured to act as (ex: {{VARCHAR}}). *Example:* The following code prints {{TEXT}} as expected {code:java} Connection connection = // A connection to a real PostgreSQL DB PreparedStatement statement = connection.prepareStatement("SELECT column1::TEXT FROM (VALUES (1, 2, 3)) a"); System.out.println(statement.executeQuery().getMetaData().getColumnTypeName(1)); {code} But the following code prints {{VARCHAR}} while I It should print {{TEXT}} instead {code:java} Connection connection = DriverManager.getConnection("jdbc:calcite:", info); connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT", new RelProtoDataType() { @Override public RelDataType apply(RelDataTypeFactory factory) { return factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), false); } }); PreparedStatement statement = connection.prepareStatement("SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)) a"); System.out.println(statement.executeQuery().getMetaData().getColumnTypeName(1)); {code} > Babel parser should parse the PostgreSQL TEXT type > -------------------------------------------------- > > Key: CALCITE-3108 > URL: https://issues.apache.org/jira/browse/CALCITE-3108 > Project: Calcite > Issue Type: Bug > Components: babel, core > Affects Versions: 1.19.0 > Reporter: Muhammad Gelbana > Assignee: Muhammad Gelbana > Priority: Minor > Labels: pull-request-available > Fix For: 1.20.0 > > Time Spent: 3.5h > Remaining Estimate: 0h > > Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The > following query would fail in parsing and execution. > {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)