Re: Problem with dumping bloom extension

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with dumping bloom extension
Date: 2016-06-03 16:31:44
Message-ID: 20160603163144.GF21416@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael,

* Michael Paquier (michael(dot)paquier(at)gmail(dot)com) wrote:
> On Fri, Jun 3, 2016 at 8:57 PM, Thom Brown <thom(at)linux(dot)com> wrote:
> > If a database with the bloom extension installed is dumped and restored,
> > there's an error with the access method creation:
> >
> > createdb bloomtest
> > psql -c 'CREATE EXTENSION bloom;' bloomtest
> > pg_dump -d bloomtest > ~/tmp/bloom.sql
> > createdb bloomtest2
> > psql -d bloomtest2 -f ~/tmp/bloom.sql
> >
> > The output of the last command produces:
> >
> > "psql:/home/thom/tmp/bloom.sql:48: ERROR: access method "bloom" already
> > exists"
> >
> > So pg_dump shouldn't be dumping this access method as it's part of the
> > extension.
>
> Stephen, something is smelling wrong in checkExtensionMembership()
> since 5d58999, an access method does not have ACLs and I would have
> expected that when this routine is invoked in
> selectDumpableAccessMethod() the object is not selected as dumpable.

Yeah, I saw this also and was going to look into it.

I suspect the issue may actually be that dumpAccessMethod() wasn't ever
updated to have the appropriate conditionals for each of the components
of the object.

Specifically, there should be if statements along the lines of:

if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry ...

if (aminfo->dobj.dump & DUMP_COMPONENT_COMMENT)
dumpComment()

towards the end of dumpAccessMethod().

I'm not 100% sure that addresses this, but it definitely needs to be
fixed also. I'll take care of it in the next few days.

I'll also look more directly into what's going on here this weekend when
I've got a bit more time to do so.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-06-03 16:31:58 Re: Perf Benchmarking and regression.
Previous Message Andres Freund 2016-06-03 16:26:46 Re: Perf Benchmarking and regression.