Skip to content

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

Remove mention of safeupdate temporarily (#28013)

Chris Gwilliams77529b234bd6
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index 7bdd5f41196..b19cafea7aa 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -880,10 +880,6 @@ export const database: NavMenuConstant = {
name: 'PostGIS: Geo queries',
url: '/guides/database/extensions/postgis',
},
- {
- name: 'pg-safeupdate: Required Where Clauses',
- url: '/guides/database/extensions/pg-safeupdate',
- },
{
name: 'pgsodium (pending deprecation): Encryption Features',
url: '/guides/database/extensions/pgsodium',
diff --git a/apps/docs/content/guides/api/securing-your-api.mdx b/apps/docs/content/guides/api/securing-your-api.mdx
index ecba3113396..6b54463d0fe 100644
--- a/apps/docs/content/guides/api/securing-your-api.mdx
+++ b/apps/docs/content/guides/api/securing-your-api.mdx
@@ -53,26 +53,6 @@ Any table **without RLS enabled** in the `public` schema will be accessible to t
</Admonition>
-## Safeguards towards accidental deletes and updates
-
-By default, all projects have the [safeupdate](https://github.com/eradman/pg-safeupdate) Postgres extension enabled for API queries. This ensures that `delete()` and `update()` requests will fail if there are no filters provided.
-
-To confirm that safeupdate is enabled for API queries, run the following query:
-
-```sql
-select
- usename,
- useconfig
-from pg_shadow
-where usename = 'authenticator';
-```
-
-The expected value for `useconfig` should be:
-
-```javascript
-;['session_preload_libraries=supautils, safeupdate']
-```
-
## Disable the API or restrict to custom schema
If you don't use the Data API, or if you don't want to expose the `public` schema, you can either disable it entirely or change the automatically exposed schema to one of your choice. See **[Hardening the Data API](/docs/guides/database/hardening-data-api)** for instructions.
diff --git a/apps/docs/content/guides/database/extensions/pg-safeupdate.mdx b/apps/docs/content/guides/database/extensions/pg-safeupdate.mdx
deleted file mode 100644
index c071df2b88a..00000000000
--- a/apps/docs/content/guides/database/extensions/pg-safeupdate.mdx
+++ /dev/null
@@ -1,54 +0,0 @@
----
-id: 'pg-safeupdate'
-title: 'pg-safeupdate: Required Where Clauses'
-description: 'Requires a where clause for update and delete'
----
-
-[pg-safeupdate](https://github.com/eradman/pg-safeupdate) is a PostgreSQL extension designed to prevent users from accidentally updating or deleting too many records in a single statement by requiring a "where" clause in all update and delete statements.
-
-The `pg-safeupdate` extension is a useful tool for protecting data integrity and preventing accidental data loss. Without it, a user could accidentally execute an update or delete statement that affects all records in a table. With `pg-safeupdate`, users are required to be more deliberate in their update and delete statements, which reduces the risk of significant error.
-
-## Enable the extension
-
-`pg-safeupdate` can be enabled on a role basis (where `anon` is the role we want to modify in this example):
-
-{/* prettier-ignore */}
-```sql
-GRANT SET ON PARAMETER session_preload_libraries TO anon;
-ALTER ROLE anon SET session_preload_libraries = 'safeupdate';
-```
-
-or for all connections:
-
-{/* prettier-ignore */}
-```sql
-alter database some_db set session_preload_libraries = 'safeupdate';
-```
-
-## Usage
-
-Let's take a look at an example to see how pg-safeupdate works. Suppose we have a table called `employees` with the following columns: `id`, `name`, `department`, and `date_of_birth`. We want to update the `date_of_birth` for a specific employee with the `id` of 12345. Here is what the query would look like if we forgot to add a "where" clause:
-
-{/* prettier-ignore */}
-```sql
-update employees set date_of_birth = '1987-01-28';
-```
-
-This query updates the `date_of_birth` for all employees to 1987-01-28, which is not what we intended. With `pg-safeupdate` enabled, we receive an error message prompting us to add a "where" clause to the query:
-
-{/* prettier-ignore */}
-```sql
-ERROR: UPDATE requires a WHERE clause
-```
-
-We would then update our query to include a "where" clause specifying the employee with the `id` of 12345:
-
-{/* prettier-ignore */}
-```sql
-update employees set date_of_birth = '1987-01-28' where id = 12345;
-```
-
-## Resources
-
-- Official [pg-safeupdate documentation](https://github.com/eradman/pg-safeupdate)
-- Using [pg-safeupdate with PostgREST](https://postgrest.org/en/v12/integrations/pg-safeupdate.html)