Postgresql
如何確定複製訂閱屬於哪個數據庫?
跟隨https://stackoverflow.com/questions/68720250/cannot-drop-subscription-from-postgresql
看來要取消訂閱,您首先需要連接到關聯的數據庫。但是我不確定如何確定訂閱屬於哪個數據庫?
我想刪除的訂閱範例:
finder_v2=# SELECT * FROM pg_subscription; subdbid | subname | subowner | subenabled | subconninfo | subslotname | subsynccommit | subpublications ---------+---------+----------+------------+---------------------------------------------------------------------------------------------------+-------------+---------------+----------------- 16384 | chris | 10 | t | host=localhost user=postgres password=mysecretpassword port=5555 dbname=finder connect_timeout=10 | chris | off | {chris} (1 row)
我對此進行了網路搜尋,並閱讀了一些 postgres 文件,但仍然無法弄清楚。
subdbid
標識定義訂閱的數據庫:select * from pg_database where oid = 16384;
或將其加入 pg_subscription:
SELECT d.datname, s.subname, s.subowner::regrole::text FROM pg_subscription s join pg_database d on d.oid = s.subdbid;