You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何列出通过create_replication_set()创建的pglogical replication sets?

Listing pglogical Replication Sets Created with create_replication_set()

Got it, I’ve run into this exact gap in the pglogical docs before—they don’t explicitly call out how to list all your custom replication sets, but it’s easy once you know where to look in PostgreSQL’s catalogs that pglogical uses.

Quick List of All Replication Sets

The simplest way is to query the built-in pglogical.replication_set view. This view tracks every replication set (including the default ones that pglogical creates automatically):

SELECT set_name, is_default, replicate_insert, replicate_update, replicate_delete
FROM pglogical.replication_set;

Here’s what those key columns mean:

  • set_name: The name of your replication set (the one you passed to create_replication_set())
  • is_default: Marks if this is one of pglogical’s pre-built sets like default or ddl_sql
  • replicate_insert/update/delete: Boolean flags showing which DML operations the set replicates

Get Replication Sets + Their Associated Tables

If you need to see which tables are part of each replication set, join the replication_set view with replication_set_table (and PostgreSQL’s core catalogs to get human-readable table names):

SELECT 
    rs.set_name,
    n.nspname AS schema_name,
    c.relname AS table_name
FROM pglogical.replication_set rs
JOIN pglogical.replication_set_table rst ON rs.set_oid = rst.set_oid
JOIN pg_class c ON rst.relid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
ORDER BY rs.set_name, schema_name, table_name;

This will give you a clean list mapping each replication set to its tables, which is super useful for auditing or troubleshooting replication scope.

Bonus: Check View Structure in psql

If you’re using the psql command line tool, you can quickly inspect the full structure of these views with:

\d pglogical.replication_set
\d pglogical.replication_set_table

That’ll show you all available columns if you need more details (like replication triggers or sequence replication settings).

内容的提问来源于stack exchange,提问作者guettli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:01:08