The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: bytea null values (#34014)
Alaister Youngff73443aa3d9
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/ForeignRowSelector/SelectorGrid.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/ForeignRowSelector/SelectorGrid.tsxindex edcec11d2b8..e9bfcd2e022 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/ForeignRowSelector/SelectorGrid.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/ForeignRowSelector/SelectorGrid.tsx@@ -1,3 +1,4 @@+import { NullValue } from 'components/grid/components/common/NullValue'import { COLUMN_MIN_WIDTH } from 'components/grid/constants'import type { SupaRow, SupaTable } from 'components/grid/types'import {@@ -34,16 +35,24 @@ const columnRender = (name: string, isPrimaryKey = false) => {)}+// TODO: move this formatter out to a common componentconst formatter = ({ column, format, row }: { column: string; format: string; row: SupaRow }) => {const formattedValue =format === 'bytea'? convertByteaToHex(row[column])- : typeof row[column] === 'object'- ? JSON.stringify(row[column])- : row[column]+ : row[column] === null+ ? null+ : typeof row[column] === 'object'+ ? JSON.stringify(row[column])+ : row[column]+return (<div className="group sb-grid-select-cell__formatter overflow-hidden">- <span className="text-sm truncate">{formattedValue}</span>+ {formattedValue === null ? (+ <NullValue />+ ) : (+ <span className="text-sm truncate">{formattedValue}</span>+ )}</div>)}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.tsindex 19e3b245aa0..3fe9a5d7d86 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts@@ -266,5 +266,10 @@ export const isValueTruncated = (value: string | null | undefined) => {}export const convertByteaToHex = (value: { type: 'Buffer'; data: number[] }) => {+ // [Alaister] this is just a safeguard to catch sneaky null values+ if (!value) {+ return value+ }+return `\\x${Buffer.from(value.data).toString('hex')}`}