Thread

Commits

  1. Ignore publication tables when --no-publications is used

  1. [patch] Bug in pg_dump/pg_restore using --no-publication

    Gilles Darold <gilles.darold@dalibo.com> — 2018-09-21T15:44:02Z

    Hi,
    
    
    Attached is a patch that fixes a bug in pg_dump since 10.0 and
    reproducible in master. When using option --no-publication : ALTER
    PUBLICATION orders are still present in the dump.
    
    
    Steps to reproduce:
    
    postgres=# CREATE DATABASE test;
    CREATE DATABASE
    postgres=# \c test
    You are now connected to database "test" as user "postgres".
    test=# create table t1 (id integer);
    CREATE TABLE
    test=# CREATE PUBLICATION p1 FOR TABLE t1;
    CREATE PUBLICATION
    test=# CREATE PUBLICATION p_all FOR ALL TABLES;
    CREATE PUBLICATION
    test=# CREATE PUBLICATION p_insert_only FOR TABLE t1 WITH (publish =
    'insert');
    CREATE PUBLICATION
    test=# \q
    
    $ pg_dump -p 5400 --no-publication test | grep PUBLICATION
    -- Name: p1 t1; Type: PUBLICATION TABLE; Schema: public; Owner:
    ALTER PUBLICATION p1 ADD TABLE ONLY public.t1;
    -- Name: p_insert_only t1; Type: PUBLICATION TABLE; Schema: public; Owner:
    ALTER PUBLICATION p_insert_only ADD TABLE ONLY public.t1;
    
    
    pg_restore suffers the same problem:
    
    pg_restore --no-publication test.dump | grep PUBLICATION
    -- Name: p1 t1; Type: PUBLICATION TABLE; Schema: public; Owner:
    ALTER PUBLICATION p1 ADD TABLE ONLY public.t1;
    -- Name: p_insert_only t1; Type: PUBLICATION TABLE; Schema: public; Owner:
    ALTER PUBLICATION p_insert_only ADD TABLE ONLY public.t1;
    
    pg_restore --no-publication test.dump -l test.dump| grep PUBLICATION
    2230; 6106 16389 PUBLICATION TABLE public p1 t1
    2231; 6106 16392 PUBLICATION TABLE public p_insert_only t1
    
    
    Should I add it to current commitfest ?
    
    
    -- 
    Gilles Darold
    Consultant PostgreSQL
    http://dalibo.com - http://dalibo.org
    
    
  2. Re: [patch] Bug in pg_dump/pg_restore using --no-publication

    Michael Paquier <michael@paquier.xyz> — 2018-09-25T02:08:30Z

    On Fri, Sep 21, 2018 at 05:44:02PM +0200, Gilles Darold wrote:
    > Attached is a patch that fixes a bug in pg_dump since 10.0 and
    > reproducible in master. When using option --no-publication : ALTER
    > PUBLICATION orders are still present in the dump.
    
    Thanks for the report, the patch, and the test case, Gilles!
    
    > pg_restore --no-publication test.dump -l test.dump| grep PUBLICATION
    > 2230; 6106 16389 PUBLICATION TABLE public p1 t1
    > 2231; 6106 16392 PUBLICATION TABLE public p_insert_only t1
    
    This command does not actually work ;)
    
    > Should I add it to current commitfest ?
    
    No need to.  I have committed your patch down to v10 after making sure
    that we are not missing any other spots, and testing each branch
    manually.
    --
    Michael