diff --git a/studio/components/grid/query/Query.utils.ts b/studio/components/grid/query/Query.utils.ts index 7d7d3384c46..652a4763688 100644 --- a/studio/components/grid/query/Query.utils.ts +++ b/studio/components/grid/query/Query.utils.ts @@ -48,7 +48,7 @@ export function deleteQuery( } if (returning) { query += - enumArrayColumns === undefined + enumArrayColumns === undefined || enumArrayColumns.length === 0 ? ` returning *` : ` returning *, ${enumArrayColumns.map((x) => `"${x}"::text[]`).join(',')}` } @@ -87,7 +87,7 @@ export function insertQuery( } if (returning) { query += - enumArrayColumns === undefined + enumArrayColumns === undefined || enumArrayColumns.length === 0 ? ` returning *` : ` returning *, ${enumArrayColumns.map((x) => `"${x}"::text[]`).join(',')}` } @@ -148,7 +148,7 @@ export function updateQuery( } if (returning) { query += - enumArrayColumns === undefined + enumArrayColumns === undefined || enumArrayColumns.length === 0 ? ` returning *` : ` returning *, ${enumArrayColumns.map((x) => `"${x}"::text[]`).join(',')}` } diff --git a/studio/components/grid/services/row/SqlRowService.ts b/studio/components/grid/services/row/SqlRowService.ts index 9d4263529ac..25302c459ac 100644 --- a/studio/components/grid/services/row/SqlRowService.ts +++ b/studio/components/grid/services/row/SqlRowService.ts @@ -96,9 +96,12 @@ export class SqlRowService implements IRowService { }) .map((column) => column.name) - let queryChains = this.query - .from(this.table.name, this.table.schema ?? undefined) - .select(`*,${enumArrayColumns.map((x) => `"${x}"::text[]`).join(',')}`) + let queryChains = + enumArrayColumns.length > 0 + ? this.query + .from(this.table.name, this.table.schema ?? undefined) + .select(`*,${enumArrayColumns.map((x) => `"${x}"::text[]`).join(',')}`) + : this.query.from(this.table.name, this.table.schema ?? undefined).select() filters .filter((x) => x.value && x.value != '') diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx index bd283c2dd56..b343b3e02af 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx @@ -139,7 +139,6 @@ const RowEditor: FC = ({ configuration.rowIdx = row!.idx } - console.log('onSaveChanges', payload) saveChanges(payload, isNewRecord, configuration, () => setLoading(false)) } else { setLoading(false)