Skip to content

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

Escape single quote when commenting on enum type (#18289)

Joshen Limdc9f296a75fe
diff --git a/studio/components/interfaces/Database/EnumeratedTypes/CreateEnumeratedTypeSidePanel.tsx b/studio/components/interfaces/Database/EnumeratedTypes/CreateEnumeratedTypeSidePanel.tsx
index 9735caa03da..915f72ee865 100644
--- a/studio/components/interfaces/Database/EnumeratedTypes/CreateEnumeratedTypeSidePanel.tsx
+++ b/studio/components/interfaces/Database/EnumeratedTypes/CreateEnumeratedTypeSidePanel.tsx
@@ -81,7 +81,7 @@ const CreateEnumeratedTypeSidePanel = ({
projectRef: project.ref,
connectionString: project.connectionString,
name: data.name,
- description: data.description,
+ description: data.description?.replaceAll("'", "''"),
values: data.values.filter((x) => x.value.length > 0).map((x) => x.value),
})
}
diff --git a/studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx b/studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx
index 93ea98db599..6bea2c31c06 100644
--- a/studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx
+++ b/studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx
@@ -110,7 +110,7 @@ const EditEnumeratedTypeSidePanel = ({
isNew: x.isNew,
})),
...(data.description !== selectedEnumeratedType.comment
- ? { description: data.description }
+ ? { description: data.description?.replaceAll("'", "''") }
: {}),
}