You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2025/09/02 16:59:00 UTC
[jira] [Commented] (CALCITE-7157) PostgreSQL does not support string literal in ORDER BY clause
[ https://issues.apache.org/jira/browse/CALCITE-7157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18017728#comment-18017728 ]
Mihai Budiu commented on CALCITE-7157:
--------------------------------------
I think there is already a rule which removes constant expressions from the sort fields. Why not just use that?
> PostgreSQL does not support string literal in ORDER BY clause
> -------------------------------------------------------------
>
> Key: CALCITE-7157
> URL: https://issues.apache.org/jira/browse/CALCITE-7157
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.40.0
> Reporter: Zhen Chen
> Priority: Major
> Labels: pull-request-available
>
> In RelToSqlConverterTest, the following test passes, but the expectedSql does not work in PostgreSQL. PostgreSQL does not support string literal in ORDER BY clause.
> {code:java}
> @Test void testOrderByConstants() {
> final String query = ""
> + "select \"employee_id\", 'abc' as c\n"
> + "from \"foodmart\".\"employee\"\n"
> + "order by c";
> final String expectedSql = ""
> + "SELECT \"employee_id\", 'abc' AS \"C\"\n"
> + "FROM \"foodmart\".\"employee\"\n"
> + "ORDER BY 'abc'";
> sql(query).withPostgresql().ok(expectedSql);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)