Re: Verbose output of pg_dump not show schema name

Lists: pgsql-hackers
From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Verbose output of pg_dump not show schema name
Date: 2014-04-17 02:41:52
Message-ID: CAFcNs+ow5jWzZEKRJwDJgj8u0LQPcp++AZ_yUC2M6b14iZ4raQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

There are some reason to verbose output of pg_dump don't show schema name?

A output example of using "pg_dump -Fd -j8 -v"

...
pg_dump: dumping contents of table geocoordinate
pg_dump: dumping contents of table historyvalue
pg_dump: dumping contents of table historyvalue
pg_dump: dumping contents of table transactionlog
pg_dump: dumping contents of table historyvalue
pg_dump: dumping contents of table historyvalue
pg_dump: dumping contents of table historyvalue
pg_dump: dumping contents of table historyvalue
...

This database have a lot of different schemas with same structure and if I
need do view the status of dump I don't know what schema the table are dump
from.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: fabriziomello(at)gmail(dot)com
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 05:14:23
Message-ID: CAB7nPqQA5mCZLuQdrWKc9yRM8T2EORU0ek_yQDbn7SvpdCFbSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 11:41 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> Hi all,
>
> There are some reason to verbose output of pg_dump don't show schema name?
>
> A output example of using "pg_dump -Fd -j8 -v"
Specifying a target directory with "-f" is better here...

> This database have a lot of different schemas with same structure and if I
> need do view the status of dump I don't know what schema the table are dump
> from.
Yes this may be helpful. The attached quick'n dirty patch implements it.
--
Michael

Attachment Content-Type Size
20140417_dump_schema_verbose.patch text/plain 772 bytes

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 14:29:03
Message-ID: CAFcNs+oE4=Un9VfGDAtsYs4GL7f=zsqnp_KyiQ3nwhWVE6+i+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 2:14 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> On Thu, Apr 17, 2014 at 11:41 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> > Hi all,
> >
> > There are some reason to verbose output of pg_dump don't show schema
name?
> >
> > A output example of using "pg_dump -Fd -j8 -v"
> Specifying a target directory with "-f" is better here...
>

Yeah... I'm just show the relevant options used... ;-)

> > This database have a lot of different schemas with same structure and
if I
> > need do view the status of dump I don't know what schema the table are
dump
> > from.
> Yes this may be helpful. The attached quick'n dirty patch implements it.
>

Very nice... thanks!!!

I add schema name do the following messages too:

pg_restore: processing data for table "public"."bar"
pg_restore: processing data for table "public"."foo"
pg_restore: processing data for table "s1"."bar"
pg_restore: processing data for table "s1"."foo"
pg_restore: processing data for table "s2"."bar"
pg_restore: processing data for table "s2"."foo"
pg_restore: processing data for table "s3"."bar"
pg_restore: processing data for table "s3"."foo"

And:

pg_dump: finding the columns and types of table "s1"."foo"
pg_dump: finding the columns and types of table "s1"."bar"
pg_dump: finding the columns and types of table "s2"."foo"
pg_dump: finding the columns and types of table "s2"."bar"
pg_dump: finding the columns and types of table "s3"."foo"
pg_dump: finding the columns and types of table "s3"."bar"
pg_dump: finding the columns and types of table "public"."foo"
pg_dump: finding the columns and types of table "public"."bar"

And:

pg_dump: processing data for table "public"."bar"
pg_dump: dumping contents of table public.bar
pg_dump: processing data for table "public"."foo"
pg_dump: dumping contents of table public.foo
pg_dump: processing data for table "s1"."bar"
pg_dump: dumping contents of table s1.bar
pg_dump: processing data for table "s1"."foo"
pg_dump: dumping contents of table s1.foo
pg_dump: processing data for table "s2"."bar"
pg_dump: dumping contents of table s2.bar
pg_dump: processing data for table "s2"."foo"
pg_dump: dumping contents of table s2.foo
pg_dump: processing data for table "s3"."bar"
pg_dump: dumping contents of table s3.bar
pg_dump: processing data for table "s3"."foo"
pg_dump: dumping contents of table s3.foo

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

Attachment Content-Type Size
dump_restore_schema_verbose_v1.patch text/x-diff 2.0 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 14:36:35
Message-ID: 20140417143635.GA7443@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 11:29:03AM -0300, Fabrízio de Royes Mello wrote:
> > > This database have a lot of different schemas with same structure and if I
> > > need do view the status of dump I don't know what schema the table are dump
> > > from.
> > Yes this may be helpful. The attached quick'n dirty patch implements it.
> >
>
> Very nice... thanks!!!
>
> I add schema name do the following messages too:
>
> pg_restore: processing data for table "public"."bar"
> pg_restore: processing data for table "public"."foo"
> pg_restore: processing data for table "s1"."bar"
> pg_restore: processing data for table "s1"."foo"
> pg_restore: processing data for table "s2"."bar"
> pg_restore: processing data for table "s2"."foo"
> pg_restore: processing data for table "s3"."bar"
> pg_restore: processing data for table "s3"."foo"

Can you get that to _conditionally_ double-quote the strings? In fact,
maybe we don't even need the double-quotes. How do we double-quote
other places?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 15:07:39
Message-ID: CAFcNs+qTaiyJf7YWoOZ6SLzUpwPgJfYB-28Ob7SZFAqimXwKkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 11:36 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> On Thu, Apr 17, 2014 at 11:29:03AM -0300, Fabrízio de Royes Mello wrote:
> > > > This database have a lot of different schemas with same structure
and if I
> > > > need do view the status of dump I don't know what schema the table
are dump
> > > > from.
> > > Yes this may be helpful. The attached quick'n dirty patch implements
it.
> > >
> >
> > Very nice... thanks!!!
> >
> > I add schema name do the following messages too:
> >
> > pg_restore: processing data for table "public"."bar"
> > pg_restore: processing data for table "public"."foo"
> > pg_restore: processing data for table "s1"."bar"
> > pg_restore: processing data for table "s1"."foo"
> > pg_restore: processing data for table "s2"."bar"
> > pg_restore: processing data for table "s2"."foo"
> > pg_restore: processing data for table "s3"."bar"
> > pg_restore: processing data for table "s3"."foo"
>
> Can you get that to _conditionally_ double-quote the strings?

Sorry, I didn't understand what you means? Your idea is to check if the
namespace is available and then don't show the double-quote, is that?

> In fact,
> maybe we don't even need the double-quotes. How do we double-quote
> other places?
>

Checking that more deeply I found some other places that show the table
name and all of them are double-quoted.

$ grep 'table \\\"%s' src/bin/pg_dump/*.c
src/bin/pg_dump/common.c: write_msg(NULL, "failed sanity
check, parent OID %u of table \"%s\" (OID %u) not found\n",
src/bin/pg_dump/pg_backup_archiver.c: ahlog(AH, 1,
"processing data for table \"%s\".\"%s\"\n",
src/bin/pg_dump/pg_backup_archiver.c: ahlog(AH, 1, "table \"%s\" could
not be created, will not restore its data\n",
src/bin/pg_dump/pg_backup_db.c: warn_or_exit_horribly(AH,
modulename, "COPY failed for table \"%s\": %s",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "Dumping the contents of
table \"%s\" failed: PQgetCopyData() failed.\n", classname);
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "Dumping the contents of
table \"%s\" failed: PQgetResult() failed.\n", classname);
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "WARNING: owner of
table \"%s\" appears to be invalid\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "reading indexes for
table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "reading foreign key
constraints for table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "reading triggers for
table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: exit_horribly(NULL,
"query produced null referenced table name for foreign key trigger \"%s\"
on table \"%s\" (OID of table: %u)\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "finding the
columns and types of table \"%s\".\"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "finding the
columns and types of table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: "invalid column
numbering in table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "finding default
expressions of table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: "invalid adnum
value %d for table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "finding check
constraints for table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL,
ngettext("expected %d check constraint on table \"%s\" but found %d\n",
src/bin/pg_dump/pg_dump.c:
"expected %d check constraints on table \"%s\" but found %d\n",
src/bin/pg_dump/pg_dump.c: exit_horribly(NULL, "invalid column number %d
for table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "invalid argument
string (%s) for trigger \"%s\" on table \"%s\"\n",
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "query to get rule \"%s\"
for table \"%s\" failed: wrong number of rows returned\n",

Just the "dumping contents of table.." message isn't double-quoted:

$ grep 'table %s' src/bin/pg_dump/*.c
src/bin/pg_dump/pg_dump.c: write_msg(NULL, "dumping contents of
table %s\n",

So maybe we must double-quote of all string, i.e. "public.foo", including
the missing bellow.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 15:31:54
Message-ID: 20140417153154.GD7443@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 12:07:39PM -0300, Fabrízio de Royes Mello wrote:
> > Can you get that to _conditionally_ double-quote the strings? 
>
> Sorry, I didn't understand what you means? Your idea is to check if the
> namespace is available and then don't show the double-quote, is that?

The idea is that we only need quotes when there are odd characters in
the identifier. We do that right now in some places, though I can't
find them in pg_dump. I know psql does that, see quote_ident().

> > In fact,
> > maybe we don't even need the double-quotes.  How do we double-quote
> > other places?
> >
>
> Checking that more deeply I found some other places that show the table name
> and all of them are double-quoted.

OK.

> Just the "dumping contents of table.." message isn't double-quoted:
>
> $ grep 'table %s' src/bin/pg_dump/*.c
> src/bin/pg_dump/pg_dump.c:            write_msg(NULL, "dumping contents of
> table %s\n",
>
>
> So maybe we must double-quote of all string, i.e. "public.foo", including the
> missing bellow.

No, I think double-quoting each part is the correct way.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 15:44:37
Message-ID: 15951.1397749477@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> The idea is that we only need quotes when there are odd characters in
> the identifier. We do that right now in some places, though I can't
> find them in pg_dump. I know psql does that, see quote_ident().

I think our general style rule is that identifiers embedded in messages
are always double-quoted. There's an exception for type names, but
not otherwise. You're confusing the message case with printing SQL.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 15:46:39
Message-ID: 20140417154639.GF7443@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > The idea is that we only need quotes when there are odd characters in
> > the identifier. We do that right now in some places, though I can't
> > find them in pg_dump. I know psql does that, see quote_ident().
>
> I think our general style rule is that identifiers embedded in messages
> are always double-quoted. There's an exception for type names, but
> not otherwise. You're confusing the message case with printing SQL.

OK. I was unclear if a status _display_ was a message like an error
message.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Verbose output of pg_dump not show schema name
Date: 2014-04-17 19:29:30
Message-ID: CAFcNs+rDbuCm7dxHhpGTnJe32mepVtmrJb90nVE_bRBB=UqZiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 12:46 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > > The idea is that we only need quotes when there are odd characters in
> > > the identifier. We do that right now in some places, though I can't
> > > find them in pg_dump. I know psql does that, see quote_ident().
> >
> > I think our general style rule is that identifiers embedded in messages
> > are always double-quoted. There's an exception for type names, but
> > not otherwise. You're confusing the message case with printing SQL.
>
> OK. I was unclear if a status _display_ was a message like an error
> message.
>

The attached patch fix missing double-quoted in "dumping contents of
table.." message and add schema name to other messages:
- "reading indexes for table \"%s\".\"%s\"\n"
- "reading foreign key constraints for table \"%s\".\"%s\"\n"
- "reading triggers for table \"%s\".\"%s\"\n"
- "finding the columns and types of table \"%s\".\"%s\"\n"
- "finding default expressions of table \"%s\".\"%s\"\n"
- "finding check constraints for table \"%s\".\"%s\"\n"

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

Attachment Content-Type Size
dump_restore_schema_verbose_v2.patch text/x-diff 5.5 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: fabriziomello(at)gmail(dot)com
Cc: 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-04-18 00:15:27
Message-ID: CAB7nPqToy=HHE+NsA5U_sHLbqQZba3fvUOf=1wQoiVvHsyhn8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Apr 18, 2014 at 4:29 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
>
> On Thu, Apr 17, 2014 at 12:46 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>>
>> On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
>> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> > > The idea is that we only need quotes when there are odd characters in
>> > > the identifier. We do that right now in some places, though I can't
>> > > find them in pg_dump. I know psql does that, see quote_ident().
>> >
>> > I think our general style rule is that identifiers embedded in messages
>> > are always double-quoted. There's an exception for type names, but
>> > not otherwise. You're confusing the message case with printing SQL.
>>
>> OK. I was unclear if a status _display_ was a message like an error
>> message.
>>
>
> The attached patch fix missing double-quoted in "dumping contents of
> table.." message and add schema name to other messages:
> - "reading indexes for table \"%s\".\"%s\"\n"
> - "reading foreign key constraints for table \"%s\".\"%s\"\n"
> - "reading triggers for table \"%s\".\"%s\"\n"
>
> - "finding the columns and types of table \"%s\".\"%s\"\n"
> - "finding default expressions of table \"%s\".\"%s\"\n"
> - "finding check constraints for table \"%s\".\"%s\"\n"
Cool additions. There may be a more elegant way to check if namespace
is NULL, but I couldn't come up with one myself. So patch may be fine.
--
Michael


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: 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-07-23 21:48:23
Message-ID: CAFcNs+qNHVcKQYbg-iGZe1e52oZ6sLm5QenRJs948qdyj9Hgfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 17, 2014 at 9:15 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> On Fri, Apr 18, 2014 at 4:29 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> >
> > On Thu, Apr 17, 2014 at 12:46 PM, Bruce Momjian <bruce(at)momjian(dot)us>
wrote:
> >>
> >> On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
> >> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> >> > > The idea is that we only need quotes when there are odd characters
in
> >> > > the identifier. We do that right now in some places, though I
can't
> >> > > find them in pg_dump. I know psql does that, see quote_ident().
> >> >
> >> > I think our general style rule is that identifiers embedded in
messages
> >> > are always double-quoted. There's an exception for type names, but
> >> > not otherwise. You're confusing the message case with printing SQL.
> >>
> >> OK. I was unclear if a status _display_ was a message like an error
> >> message.
> >>
> >
> > The attached patch fix missing double-quoted in "dumping contents of
> > table.." message and add schema name to other messages:
> > - "reading indexes for table \"%s\".\"%s\"\n"
> > - "reading foreign key constraints for table \"%s\".\"%s\"\n"
> > - "reading triggers for table \"%s\".\"%s\"\n"
> >
> > - "finding the columns and types of table \"%s\".\"%s\"\n"
> > - "finding default expressions of table \"%s\".\"%s\"\n"
> > - "finding check constraints for table \"%s\".\"%s\"\n"
> Cool additions. There may be a more elegant way to check if namespace
> is NULL, but I couldn't come up with one myself. So patch may be fine.
>

Hi all,

I think this small patch was lost. There are something wrong?

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(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-07-24 19:36:32
Message-ID: CA+Tgmoaz46egBvLJSOOTW8cXDz3cPibsWz9MMsLGms0VHqJ_pQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Jul 23, 2014 at 5:48 PM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
>
> On Thu, Apr 17, 2014 at 9:15 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>>
>> On Fri, Apr 18, 2014 at 4:29 AM, Fabrízio de Royes Mello
>> <fabriziomello(at)gmail(dot)com> wrote:
>> >
>> > On Thu, Apr 17, 2014 at 12:46 PM, Bruce Momjian <bruce(at)momjian(dot)us>
>> > wrote:
>> >>
>> >> On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
>> >> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> >> > > The idea is that we only need quotes when there are odd characters
>> >> > > in
>> >> > > the identifier. We do that right now in some places, though I
>> >> > > can't
>> >> > > find them in pg_dump. I know psql does that, see quote_ident().
>> >> >
>> >> > I think our general style rule is that identifiers embedded in
>> >> > messages
>> >> > are always double-quoted. There's an exception for type names, but
>> >> > not otherwise. You're confusing the message case with printing SQL.
>> >>
>> >> OK. I was unclear if a status _display_ was a message like an error
>> >> message.
>> >>
>> >
>> > The attached patch fix missing double-quoted in "dumping contents of
>> > table.." message and add schema name to other messages:
>> > - "reading indexes for table \"%s\".\"%s\"\n"
>> > - "reading foreign key constraints for table \"%s\".\"%s\"\n"
>> > - "reading triggers for table \"%s\".\"%s\"\n"
>> >
>> > - "finding the columns and types of table \"%s\".\"%s\"\n"
>> > - "finding default expressions of table \"%s\".\"%s\"\n"
>> > - "finding check constraints for table \"%s\".\"%s\"\n"
>> Cool additions. There may be a more elegant way to check if namespace
>> is NULL, but I couldn't come up with one myself. So patch may be fine.
>>
>
> Hi all,
>
> I think this small patch was lost. There are something wrong?

Did it get added to a CommitFest?

I don't see it there.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(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-07-24 19:45:31
Message-ID: CAFcNs+pRtBUw61vAeD1=OhoRHo1dzZMwSwm7yNMsPib1-WTSzA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jul 24, 2014 at 4:36 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Wed, Jul 23, 2014 at 5:48 PM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> >
> > On Thu, Apr 17, 2014 at 9:15 PM, Michael Paquier <
michael(dot)paquier(at)gmail(dot)com>
> > wrote:
> >>
> >> On Fri, Apr 18, 2014 at 4:29 AM, Fabrízio de Royes Mello
> >> <fabriziomello(at)gmail(dot)com> wrote:
> >> >
> >> > On Thu, Apr 17, 2014 at 12:46 PM, Bruce Momjian <bruce(at)momjian(dot)us>
> >> > wrote:
> >> >>
> >> >> On Thu, Apr 17, 2014 at 11:44:37AM -0400, Tom Lane wrote:
> >> >> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> >> >> > > The idea is that we only need quotes when there are odd
characters
> >> >> > > in
> >> >> > > the identifier. We do that right now in some places, though I
> >> >> > > can't
> >> >> > > find them in pg_dump. I know psql does that, see quote_ident().
> >> >> >
> >> >> > I think our general style rule is that identifiers embedded in
> >> >> > messages
> >> >> > are always double-quoted. There's an exception for type names,
but
> >> >> > not otherwise. You're confusing the message case with printing
SQL.
> >> >>
> >> >> OK. I was unclear if a status _display_ was a message like an error
> >> >> message.
> >> >>
> >> >
> >> > The attached patch fix missing double-quoted in "dumping contents of
> >> > table.." message and add schema name to other messages:
> >> > - "reading indexes for table \"%s\".\"%s\"\n"
> >> > - "reading foreign key constraints for table \"%s\".\"%s\"\n"
> >> > - "reading triggers for table \"%s\".\"%s\"\n"
> >> >
> >> > - "finding the columns and types of table \"%s\".\"%s\"\n"
> >> > - "finding default expressions of table \"%s\".\"%s\"\n"
> >> > - "finding check constraints for table \"%s\".\"%s\"\n"
> >> Cool additions. There may be a more elegant way to check if namespace
> >> is NULL, but I couldn't come up with one myself. So patch may be fine.
> >>
> >
> > Hi all,
> >
> > I think this small patch was lost. There are something wrong?
>
> Did it get added to a CommitFest?
>
> I don't see it there.
>

Given this is a very small and simple patch I thought it's not necessary...

Added to the next CommitFest.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

Attachment Content-Type Size
dump_restore_schema_verbose_v1.patch text/x-diff 5.5 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(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-20 05:43:42
Message-ID: CAB7nPqSy3eZvoYsntr=MHXwDPrBq5B1bFLkOVz25i6gurMY_5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jul 25, 2014 at 4:45 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
>
> Given this is a very small and simple patch I thought it's not necessary...
>
> Added to the next CommitFest.

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.
2) I don't think that this is correct:
- ahlog(AH, 1, "processing data
for table \"%s\"\n",
- te->tag);
+ ahlog(AH, 1, "processing data
for table \"%s\".\"%s\"\n",
+ AH->currSchema, te->tag);
There are some code paths where AH->currSchema is set to NULL, and I
think that you should use te->namespace instead.
3) Changing only this message is not enough. The following verbose
messages need to be changed too for consistency:
- pg_dump: creating $tag $object
- pg_dump: setting owner and privileges for [blah]

I have been pondering as well about doing similar modifications to the
error message paths, but it did not seem worth it as this patch is
aimed only for the verbose output. Btw, I have basically fixed those
issues while doing the review, and finished with the attached patch.
Fabrizio, is this new version fine for you?
Regards,
--
Michael

Attachment Content-Type Size
20140820_pgdump_verbose_nspace.patch text/x-patch 7.3 KB

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: 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-20 20:11:42
Message-ID: CAFcNs+qQiyQHSsSzrM0U9t+e5cAS8q98_P4nOYxGMOK1c=JH-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

> 2) I don't think that this is correct:
> - ahlog(AH, 1, "processing data
> for table \"%s\"\n",
> - te->tag);
> + ahlog(AH, 1, "processing data
> for table \"%s\".\"%s\"\n",
> + AH->currSchema,
te->tag);
> There are some code paths where AH->currSchema is set to NULL, and I
> think that you should use te->namespace instead.

Yes, you are correct!

> 3) Changing only this message is not enough. The following verbose
> messages need to be changed too for consistency:
> - pg_dump: creating $tag $object
> - pg_dump: setting owner and privileges for [blah]
>
> I have been pondering as well about doing similar modifications to the
> error message paths, but it did not seem worth it as this patch is
> aimed only for the verbose output. Btw, I have basically fixed those
> issues while doing the review, and finished with the attached patch.
> Fabrizio, is this new version fine for you?
>

Is fine to me.

I just change "if (tbinfo->dobj.namespace != NULL)" to "if
(tbinfo->dobj.namespace)".

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Attachment Content-Type Size
dump_restore_schema_verbose_v2.patch text/x-diff 6.7 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(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-20 23:24:50
Message-ID: CAB7nPqS-fKgXF1Ax0__AOE1n8QzfsjKKizinXBa91KGYYJbx5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 21, 2014 at 5:11 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> I just change "if (tbinfo->dobj.namespace != NULL)" to "if
> (tbinfo->dobj.namespace)".
Fine for me. I am marking this patch as ready for committer.
--
Michael


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: 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-20 23:35:17
Message-ID: CAFcNs+p5eEf316qR8x2t+u=JWwxc8DzdskcS21hqpgiV5Q2RLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Aug 20, 2014 at 8:24 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> On Thu, Aug 21, 2014 at 5:11 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> > I just change "if (tbinfo->dobj.namespace != NULL)" to "if
> > (tbinfo->dobj.namespace)".
> Fine for me. I am marking this patch as ready for committer.
>

Thanks!

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


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
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


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Fabrízio Mello <fabriziomello(at)gmail(dot)com>, 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-26 07:10:39
Message-ID: CAB7nPqSHsP9oEXMSR0OHykr_X-RemyrBosifCz06bqYUcWQOJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 26, 2014 at 3:48 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> 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.
Ah right, this field is used in many places. Even for
pg_backup_archiver.c, the portion of code processing data always has
the namespace set. I am sure that Fabrizio would have done that
quickly, but as I was on this thread I simplified the patch as
attached.
Regards,
--
Michael

Attachment Content-Type Size
20140826_pgdump_verbose_nspace_v3.patch text/x-patch 4.5 KB

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Fabrízio Mello <fabriziomello(at)gmail(dot)com>, 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-26 08:53:54
Message-ID: 53FC4B22.4070805@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 08/26/2014 10:10 AM, Michael Paquier wrote:
> On Tue, Aug 26, 2014 at 3:48 AM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
>> 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.
> Ah right, this field is used in many places. Even for
> pg_backup_archiver.c, the portion of code processing data always has
> the namespace set. I am sure that Fabrizio would have done that
> quickly, but as I was on this thread I simplified the patch as

Ok thanks, committed.

- Heikki


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, 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-26 11:29:21
Message-ID: CAFcNs+oWm7tyaC7U9wbWCEKL+goOJfE+vuL9tZLc6QPMZ7s7Qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 26, 2014 at 4:10 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> On Tue, Aug 26, 2014 at 3:48 AM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
> > 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.
> Ah right, this field is used in many places. Even for
> pg_backup_archiver.c, the portion of code processing data always has
> the namespace set. I am sure that Fabrizio would have done that
> quickly, but as I was on this thread I simplified the patch as
> attached.
>

Thanks Michael... last night I was working on a refactoring in
"tablecmds.c".

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello