The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore/empty table errors (#29062)
Terry Suttonfee28293e2a1
diff --git a/apps/studio/components/grid/query/Query.utils.ts b/apps/studio/components/grid/query/Query.utils.tsindex 0fc94056bf9..aeb1cb50de2 100644--- a/apps/studio/components/grid/query/Query.utils.ts+++ b/apps/studio/components/grid/query/Query.utils.ts@@ -221,6 +221,7 @@ function applySorts(query: string, sorts: Sort[]) {if (sorts.length === 0) return queryquery += ` order by ${sorts.map((x) => {+ if (!x.column) return nullconst order = x.ascending ? 'asc' : 'desc'const nullOrder = x.nullsFirst ? 'nulls first' : 'nulls last'return `${ident(x.table)}.${ident(x.column)} ${order} ${nullOrder}`diff --git a/apps/studio/data/table-rows/table-rows-query.ts b/apps/studio/data/table-rows/table-rows-query.tsindex 7ee33db81d4..58071ebd318 100644--- a/apps/studio/data/table-rows/table-rows-query.ts+++ b/apps/studio/data/table-rows/table-rows-query.ts@@ -151,7 +151,7 @@ export const getTableRowsSqlQuery = ({})// If sorts is empty and table row count is within threshold, use the primary key as the default sort- if (sorts.length === 0 && table.estimateRowCount <= THRESHOLD_COUNT) {+ if (sorts.length === 0 && table.estimateRowCount <= THRESHOLD_COUNT && table.columns.length > 0) {const defaultOrderByColumns = getDefaultOrderByColumns(table)if (defaultOrderByColumns.length > 0) {defaultOrderByColumns.forEach((col) => {