Dear hackers,

While considering another thread, I found the $SUBJECT. Attached patch fixes it.

Documentation says:

```
pg_drop_replication_slot ( slot_name name ) → void

Drops the physical or logical replication slot named slot_name. Same as 
replication protocol command DROP_REPLICATION_SLOT.
For logical slots, this must be called while connected to the same database the 
slot was created on.
```

But this is not correct. Backend processes which connect to other databases
can drop the logical slot:

```
postgres=# SELECT * FROM pg_create_logical_replication_slot('test', 
'test_decoding');
 slot_name |    lsn    
-----------+-----------
 test      | 0/1CA6A18
(1 row)

postgres=# \c tests
You are now connected to database "tests" as user "postgres".
tests=# SELECT * FROM pg_drop_replication_slot('test');
 pg_drop_replication_slot 
--------------------------
 
(1 row)
```

IIUC, the description was added by ff539d. The initial version [1] seemed to 
have
the restriction, it was removed now but the description retained.

I think all supported versions have the same issue, attached one is for master.

Thanks Hou for confirming the issue.

[1]: 
https://www.postgresql.org/message-id/CAMsr%2BYGjZRqo-boCF9z5Bc1WZ_10RjMLtNSTsaa%3DkkE9_GmTag%40mail.gmail.com

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment: 0001-Fix-description-for-dropping-slots.patch
Description: 0001-Fix-description-for-dropping-slots.patch

Reply via email to