mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
Chore/empty table errors (#29062)
* Fix errors on empty tables * Unnecessary check
This commit is contained in:
1 parent
89ede3b820
commit
fee28293e2
2 files changed
+2
-1
No files matched your search
@@ -221,6 +221,7 @@ function applySorts(query: string, sorts: Sort[]) {
|
||||
if (sorts.length === 0) return query
|
||||
query += ` order by ${sorts
|
||||
.map((x) => {
|
||||
if (!x.column) return null
|
||||
const order = x.ascending ? 'asc' : 'desc'
|
||||
const nullOrder = x.nullsFirst ? 'nulls first' : 'nulls last'
|
||||
return `${ident(x.table)}.${ident(x.column)} ${order} ${nullOrder}`
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user