The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix CSV import for files with no rows, just headers (#4160)
Joshen Limb72e80afb45a
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.tsindex b7a0e4410e1..841bfc65d0d 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts@@ -62,6 +62,10 @@ export const inferColumnType = (column: string, rows: object[]) => {// General strategy is to check the first row first, before checking across all the rows// to ensure uniformity in data type. Thinking we do this as an optimization instead of// checking all the rows up front.++ // If there are no rows to infer for, default to text+ if (rows.length === 0) return 'text'+const columnData = (rows[0] as any)[column]const columnDataAcrossRows = rows.map((row: object) => (row as any)[column])diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.tsindex 68491e1b6c0..68c1d5ce370 100644--- a/studio/stores/pgmeta/MetaStore.ts+++ b/studio/stores/pgmeta/MetaStore.ts@@ -393,7 +393,7 @@ export default class MetaStore implements IMetaStore {// If the user is importing data via a spreadsheetif (!isUndefined(importContent)) {- if (importContent.file) {+ if (importContent.file && importContent.rowCount > 0) {// Via a CSV fileconst { error }: any = await this.insertRowsViaSpreadsheet(importContent.file,