Re: pg_dump with tables created in schemas created by extensions - Mailing list pgsql-hackers

From Martín Marqués
Subject Re: pg_dump with tables created in schemas created by extensions
Date
Msg-id CAPdiE1y0q3Z0YJ-V_VCNhu2hMzAZ4ywPJjPEX9RTTVMtDPU7-A@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump with tables created in schemas created by extensions  (Martín Marqués <martin@2ndquadrant.com>)
List pgsql-hackers
2016-08-24 17:01 GMT-03:00 Martín Marqués <martin@2ndquadrant.com>:
> 2016-08-24 11:15 GMT-03:00 Stephen Frost <sfrost@snowman.net>:
>> Michael,
>>
>> * Michael Paquier (michael.paquier@gmail.com) wrote:
>>> The patch attached includes all those tests and they are failing. We
>>> are going to need a patch able to pass all that, and even for master
>>> this is going to need more thoughts, and let's focus on HEAD/9.6
>>> first.
>>
>> Are you sure you have the tests correct..?   At least for testagg(), it
>> looks like you're testing for:
>>
>> GRANT ALL ON FUNCTION test_agg(int2) TO regress_dump_test_role;
>>
>> but what's in the dump is (equivilantly):
>>
>> GRANT ALL ON FUNCTION test_agg(smallint) TO regress_dump_test_role;
>
> Yes, that was the problem there.
>
>> I've not looked into all the failures, but at least this one seems like
>> an issue in the test, not an issue in pg_dump.
>
> I see the other 12 failures regarding the CREATE INDEX that Michael
> reported but can't quite find where it's originated. (or actually
> where the problem is)

OK, I see where the problem is.

Indexes don't have a selectDumpableIndex() function to see if we dump
it or not. We just don't gather indexes from tables for which we are
dumping their definition:
               /* Ignore indexes of tables whose definitions are not
to be dumped */               if (!(tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION))                       continue;

This means we have to perform the same change we did on
selectDumpableNamespace for selectDumpableTable, and also assign the
correct value to dump_contains, which is not set there.

The problem will come when we have to decide on which indexes were
created by the extension (primary key indexes, other indexes created
by the extension) and which were created afterwards over a table which
depends on the extension (the test_table from the extension).

Right now, I'm in an intermediate state, where I got getIndexes() to
query for the indexes of these tables, but dumpIndexes is not dumping
the indexes that were queried.

I wonder if we should have a selectDumpableIndexes to set the
appropriate dobj.dump for the Indexes.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_stat_lwlock wait time view
Next
From: Tom Lane
Date:
Subject: Better tracking of free space during SP-GiST index build