diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 69d48a99d755d3e6a021c2755a2b94eb9d8502be..cdc5dad8ecce3ee5aa924d447a13fe502f3d5f66 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2797,6 +2797,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) { bool other; int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other); if (TSDB_CODE_SUCCESS == code) { + if (0 == LIST_LENGTH(pSelect->pOrderByList)) { + NODES_DESTORY_LIST(pSelect->pOrderByList); + return TSDB_CODE_SUCCESS; + } if (!other) { return TSDB_CODE_SUCCESS; } diff --git a/tests/system-test/2-query/projectionDesc.py b/tests/system-test/2-query/projectionDesc.py index 6bb9aff4f3c8707a9fda16f4e240961ee91eaccf..1edceaa6f2ced20595132149c8d8f135111ce097 100644 --- a/tests/system-test/2-query/projectionDesc.py +++ b/tests/system-test/2-query/projectionDesc.py @@ -38,6 +38,7 @@ class TDTestCase: #tdSql.checkData(0,0,1537146000000) tdSql.checkData(0,1,10) + tdSql.query(f"select * from {dbname}.stb_1 order by 'aaa' desc") def stop(self): tdSql.close()