1

Is there a way to list all the Schemas which have been added to the replication_set?

# SELECT * FROM pglogical.replication_set;
   set_id   | set_nodeid |       set_name       | replicate_insert | replicate_update | replicate_delete | replicate_truncate
------------+------------+----------------------+------------------+------------------+------------------+--------------------
 1921995266 | 1338498914 | default              | t                | t                | t                | t
 4027572585 | 1338498914 | default_insert_only  | t                | f                | f                | t
 3823354649 | 1338498914 | ddl_sql              | t                | f                | f                | f
 1724847149 | 1338498914 | replication_set | t                | t                | t                | t
(4 rows)
# SELECT pglogical.replication_set_add_all_tables('replication_set', ARRAY['public'],true);
replication_set_add_all_tables
--------------------------------
 t
(1 row)

# SELECT pglogical.replication_set_add_all_tables('replication_set', ARRAY['catalog2'],true);
replication_set_add_all_tables
--------------------------------
 t
(1 row)
3
  • 1
    Welcome to the DBA.SE community. Could you please give an example of what you are expecting to achieve? As it stand your question (for me) is unclear. Hit the edit link and add some details to your question. Explain what you are trying to achieve and what you think would be valid results. Thanks.
    – John K. N.
    Commented Nov 19, 2021 at 7:42
  • "list the array" makes no sense to me.
    – user1822
    Commented Nov 19, 2021 at 7:52
  • I mean, How to list the schema's which added into the replication_set. In the above example, I've added two schemas(public, catalog2) into the replication_set. How to list what other schemas have been added to it? Commented Nov 21, 2021 at 7:10

2 Answers 2

3

The pglogical table replication_set_table should provide the necessary data. It contains the set_id and set_reloid (schema.table) columns that point to the schemas and tables that belong to a given replication set.

0

Building on scott's answer, a query should be something like the following:

SELECT rs.set_name, n.nspname AS schema_name, c.relname AS table_name
FROM pglogical.replication_set_table rst
    JOIN pg_class c ON rst.set_reloid = c.oid
    JOIN pg_namespace n ON c.relnamespace = n.oid
    JOIN pglogical.replication_set rs ON rst.set_id = rs.set_id
WHERE rs.set_name = 'your_replication_set_name';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.