From 3bd56bdca7be821b81d13fca1059b9fb206a6e6c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 16 Jan 2025 14:29:49 +0000 Subject: [PATCH] remove nulls for raw and rely on defaults --- packages/backend-core/src/sql/sql.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/src/sql/sql.ts b/packages/backend-core/src/sql/sql.ts index 6dc8963323..fb7cfdec1b 100644 --- a/packages/backend-core/src/sql/sql.ts +++ b/packages/backend-core/src/sql/sql.ts @@ -1167,17 +1167,15 @@ class InternalBuilder { let nulls: "first" | "last" | undefined = undefined if ( this.client === SqlClient.POSTGRES || - this.client === SqlClient.ORACLE || - this.client === SqlClient.SQL_LITE + this.client === SqlClient.ORACLE ) { nulls = value.direction === SortOrder.ASCENDING ? "first" : "last" } if (this.isAggregateField(key)) { - query = query.orderByRaw(`?? ?? nulls ??`, [ + query = query.orderByRaw(`?? ??`, [ this.rawQuotedIdentifier(key), this.knex.raw(direction), - this.knex.raw(nulls as string), ]) } else { let composite = `${aliased}.${key}` @@ -1188,10 +1186,9 @@ class InternalBuilder { this.knex.raw(nulls as string), ]) } else { - query = query.orderByRaw(`?? ?? nulls ??`, [ + query = query.orderByRaw(`?? ??`, [ this.rawQuotedIdentifier(composite), this.knex.raw(direction), - this.knex.raw(nulls as string), ]) } }