Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix the exporting of CSV to handle JSON columns.

Ivan Vasilovc56942951952
diff --git a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
index f93ac122ee5..28d3bb324a6 100644
--- a/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
+++ b/studio/components/interfaces/SQLEditor/UtilityPanel/ResultsDropdown.tsx
@@ -3,7 +3,7 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConte
import { useStore } from 'hooks'
import { copyToClipboard } from 'lib/helpers'
import Telemetry from 'lib/telemetry'
-import { compact, isString, map } from 'lodash'
+import { compact, isObject, isString, map } from 'lodash'
import { useRouter } from 'next/router'
import { useMemo, useRef } from 'react'
import { CSVLink } from 'react-csv'
@@ -34,6 +34,10 @@ const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
// escape all quotation marks
return v.replaceAll(/\n/g, '\\n').replaceAll(/"/g, '""')
}
+ if (isObject(v)) {
+ // replace all quotation marks with two quotation marks to escape them.
+ return JSON.stringify(v).replaceAll(/\"/g, '""')
+ }
return v
})
})