Skip to content

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

fix: add note about deletes and format

Chase Granberrydd715854f6e0
diff --git a/apps/docs/pages/guides/realtime/postgres-changes.mdx b/apps/docs/pages/guides/realtime/postgres-changes.mdx
index 0e4e9638855..11eea5bae5e 100644
--- a/apps/docs/pages/guides/realtime/postgres-changes.mdx
+++ b/apps/docs/pages/guides/realtime/postgres-changes.mdx
@@ -15,7 +15,9 @@ Clients can choose to receive `INSERT`, `UPDATE`, `DELETE`, or `*` (all) changes
Postgres Changes works out of the box for tables in the `public` schema. You can listen to tables in your private schemas by granting table `SELECT` permissions to the database role found in your access token. You can run a query similar to the following:
```sql
-GRANT SELECT ON "private_schema"."table" TO authenticated;
+grant
+select
+ on "private_schema"."table" to authenticated;
```
<Admonition type="caution">
@@ -29,15 +31,19 @@ You can do this in the [Replication](https://app.supabase.com/project/_/database
```sql
begin;
- -- remove the supabase_realtime publication
- drop publication if exists supabase_realtime;
- -- re-create the supabase_realtime publication with no tables
- create publication supabase_realtime;
+-- remove the supabase_realtime publication
+drop
+ publication if exists supabase_realtime;
+
+-- re-create the supabase_realtime publication with no tables
+create publication supabase_realtime;
+
commit;
-- add a table to the publication
-alter publication supabase_realtime add table messages;
+alter
+ publication supabase_realtime add table messages;
```
### Full `old` Record
@@ -46,9 +52,16 @@ By default, only `new` record changes are sent but if you want to receive the `o
you can set the `replica identity` of your table to `full`:
```sql
-alter table messages replica identity full;
+alter table
+ messages replica identity full;
```
+<Admonition type="caution">
+
+When RLS is on and `replica identity` is `full` the `old` record will only contain the primary key. You can not enforce RLS on `DELETE` statements.
+
+</Admonition>
+
## Schema Changes
To listen to all changes in the `public` schema: