pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martín Marqués <martin@2ndquadrant.com>
To: pgsql-bugs@postgresql.org
Subject: pg_dump doesn't dump new objects created in schemas from extensions
Date: Thu, 16 Jun 2016 15:19:33 -0300
Message-ID: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

I'm filling this bug report as I believe pg_dump is not generating a
consistent backup when some extensions are being used (particularly,
ones that create schemas, like PgQ).

Here is an example:

pruebas=# create extension pgq;
CREATE EXTENSION

pruebas=# select pgq.create_queue('personas');
 create_queue
--------------
            1
(1 fila)

pruebas=# select pgq.create_queue('usuarios');
 create_queue
--------------
            1
(1 fila)

pruebas=# select pgq.create_queue('usuarios_activos');
 create_queue
--------------
            1
(1 fila)

pruebas=# select pgq.create_queue('usuarios_inactivos');
 create_queue
--------------
            1
(1 fila)

pruebas=# select count(*) from pgq.tick;
 count
-------
     4
(1 fila)

pruebas=# \dt pgq.*
            Listado de relaciones
 Esquema |     Nombre     | Tipo  |  Dueño
---------+----------------+-------+----------
 pgq     | consumer       | tabla | postgres
 pgq     | event_1        | tabla | postgres
 pgq     | event_1_0      | tabla | postgres
 pgq     | event_1_1      | tabla | postgres
 pgq     | event_1_2      | tabla | postgres
 pgq     | event_2        | tabla | postgres
 pgq     | event_2_0      | tabla | postgres
 pgq     | event_2_1      | tabla | postgres
 pgq     | event_2_2      | tabla | postgres
 pgq     | event_3        | tabla | postgres
 pgq     | event_3_0      | tabla | postgres
 pgq     | event_3_1      | tabla | postgres
 pgq     | event_3_2      | tabla | postgres
 pgq     | event_4        | tabla | postgres
 pgq     | event_4_0      | tabla | postgres
 pgq     | event_4_1      | tabla | postgres
 pgq     | event_4_2      | tabla | postgres
 pgq     | event_template | tabla | postgres
 pgq     | queue          | tabla | postgres
 pgq     | retry_queue    | tabla | postgres
 pgq     | subscription   | tabla | postgres
 pgq     | tick           | tabla | postgres
(22 filas)

And just to add something else into the whole annoyance, I'll add a user
defined table:

pruebas=# create table pgq.test_pgq_dumpable (id int primary key);
CREATE TABLE
pruebas=# \dt pgq.test_pgq_dumpable
             Listado de relaciones
 Esquema |      Nombre       | Tipo  |  Dueño
---------+-------------------+-------+----------
 pgq     | test_pgq_dumpable | tabla | postgres
(1 fila)


To check that all objects from the pgq schema were dumped, I just pipe
the pg_dump to psql on a new DB:

-bash-4.3$ pg_dump  pruebas | psql -d pruebas_pgq

Now, let's check what we have on this new DB:

pruebas_pgq=# \dt pgq.test_pgq_dumpable
No se encontraron relaciones coincidentes.
pruebas_pgq=# \dt pgq.*
            Listado de relaciones
 Esquema |     Nombre     | Tipo  |  Dueño
---------+----------------+-------+----------
 pgq     | consumer       | tabla | postgres
 pgq     | event_template | tabla | postgres
 pgq     | queue          | tabla | postgres
 pgq     | retry_queue    | tabla | postgres
 pgq     | subscription   | tabla | postgres
 pgq     | tick           | tabla | postgres
(6 filas)


This problem came up due to a difference between pg_dump on 9.1.12 and
9.1.22 (before is dumped all the tables and sequences and with the new
point release is doesn't anymore), but here I'm using 9.5.3:

pruebas_pgq=# select version();
                                                 version

---------------------------------------------------------------------------------------------------------
 PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 5.3.1
20160406 (Red Hat 5.3.1-6), 64-bit
(1 fila)

Regards,

-- 
Martín Marqués                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (20+ messages)  latest in thread

Message-ID: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com>
Permalink:  ../409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com/
Also on:    postgresql.org/message-id/409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: martin@2ndquadrant.com
  Subject: Re: pg_dump doesn't dump new objects created in schemas from extensions
  In-Reply-To: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com>
  References: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox