Re: Bug in pg_dump

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in pg_dump
Date: 2015-02-28 16:09:52
Message-ID: 20150228160952.GJ29780@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:
> + /*
> + * Query all the foreign key dependencies for all the extension
> + * tables found previously. Only tables whose data need to be
> + * have to be tracked.
> + */
> + appendPQExpBuffer(query2,
> + "SELECT conrelid, confrelid "
> + "FROM pg_catalog.pg_constraint "
> + "WHERE contype = 'f' AND conrelid IN (");
> +
> + for (j = 0; j < nconfigitems; j++)
> + {

[...]

Instead of building up a (potentially) big list like this, couldn't we
simply join against pg_extension and check if conrelid = ANY (extconfig)
instead, based on the extension we're currently processing?

eg:

appendPQExpBuffer(query2,
"SELECT conrelid, confrelid "
"FROM pg_catalog.pg_constraint, pg_extension "
"WHERE contype = 'f' AND extname = '%s' AND conrelid = ANY (extconfig)",
fmtId(curext->dobj.name));

This seemed to work just fine for me, at least, and reduces the size of
the patch a bit further since we don't need the loop that builds up the
ids.

> Subject: [PATCH 2/3] Make prove_check install contents of current directory as well

This is really an independent thing, no? I don't see any particular
problem with it, for my part.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-02-28 16:11:05 Re: star schema and the optimizer
Previous Message Stephen Frost 2015-02-28 15:01:32 Re: Bug in pg_dump