Re: Verbose output of pg_dump not show schema name - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Verbose output of pg_dump not show schema name
Date
Msg-id 53FB84F4.5000209@vmware.com
Whole thread Raw
In response to Re: Verbose output of pg_dump not show schema name  (Fabrízio de Royes Mello <fabriziomello@gmail.com>)
Responses Re: Verbose output of pg_dump not show schema name
List 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.paquier@gmail.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




pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Concurrently option for reindexdb
Next
From: Tom Lane
Date:
Subject: Re: Hardening pg_upgrade