Re: Verbose output of pg_dump not show schema name

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: <fabriziomello(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-08-25 18:48:20
Message-ID: 53FB84F4.5000209@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/20/2014 11:11 PM, Fabrízio de Royes Mello wrote:
> On Wed, Aug 20, 2014 at 2:43 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>>
>> I had a look at this patch, and here are a couple of comments:
>> 1) Depending on how ArchiveEntry is called to register an object to
>> dump, namespace may be NULL, but it is not the case
>> namespace->dobj.name, so you could get the namespace name at the top
>> of the function that have their verbose output improved with something
>> like that:
>> const char *namespace = tbinfo->dobj.namespace ?
>> tbinfo->dobj.namespace->dobj.name : NULL;
>> And then simplify the message output as follows:
>> if (namespace)
>> write_msg("blah \"%s\".\"%s\" blah", namespace, classname);
>> else
>> write_msg("blah \"%s\" blah", classname);
>> You can as well safely remove the checks on namespace->dobj.name.
>
> Ok

AFAICS, the namespace can never be NULL in any of these. There is a
"selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name)" call
before or after printing the message, so if tbinfo->dobj.namespace is
NULL, you'll crash anyway. Please double-check, and remove the dead code
if you agree.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-08-25 19:04:52 Re: Hardening pg_upgrade
Previous Message Fujii Masao 2014-08-25 18:48:09 Re: Concurrently option for reindexdb