0

We use the tool etckeeper to keep track of the configuration of servers.

I would like to dump the configuration of pglogical to files for this purpose.

I tried this:

db@host:~$ pg_dump -t 'pglogical.replication_set'

But the output looks empty:

--
-- PostgreSQL database dump
--

-- Dumped from database version 11.5
-- Dumped by pg_dump version 11.5

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- PostgreSQL database dump complete
--

How can I dump the configuration of pglogical?

Use Case:

  • dump it hourly and store it in git to see what was changed.
  • compare two hosts to see if the configuration is equal.

1 Answer 1

1

The table belongs to the extension pglogical, so pg_dump doesn't dump it.

Objects that belong to an extension don't get included in the dump, they are subsumed in the CREATE EXTENSION command from a database dump, because that object will be created by the CREATE EXTENSION command. If the object itself got dumped too, restoring the dump would cause an error, because the object already exists after CREATE EXTENSION.

You could use psql and do something like

\copy (SELECT * FROM pglogical.replication_set ORDER BY ...) TO 'some.file' (FORMAT 'csv')
4
  • Thank you for this answer. Now the next question is here. What do these tables and columns of pglogical mean? I asked here for docs: github.com/2ndQuadrant/pglogical/issues/221
    – guettli
    Commented Sep 20, 2019 at 8:29
  • 1
    You asked at the right place. Commented Sep 20, 2019 at 8:41
  • "Objects that belong to an extension don't get included in the dump", if you'd care to elaborate on that a bit more, I was having a similar issue a while back. Commented Sep 20, 2019 at 9:25
  • I tried to spell it out - I guess I am too familiar with this stuff, so i assume that it is obvious. Commented Sep 20, 2019 at 9:48

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.