pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump formatting
8+ messages / 4 participants
[nested] [flat]
* pg_dump formatting
@ 2009-03-20 04:35 Caleb Cushing <xenoterracide@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Caleb Cushing @ 2009-03-20 04:35 UTC (permalink / raw)
To: pgsql-admin
is there any way to format the output of pg_dump? in a way that is
more diff-able? like line wrap on each row, record or something? that
way you can easily find the differences of each dump if need be?
--
Caleb Cushing
http://xenoterracide.blogspot.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-20 14:31 Bruce Momjian <bruce@momjian.us>
parent: Caleb Cushing <xenoterracide@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 2009-03-20 14:31 UTC (permalink / raw)
To: Caleb Cushing <xenoterracide@gmail.com>; +Cc: pgsql-admin
Caleb Cushing wrote:
> is there any way to format the output of pg_dump? in a way that is
> more diff-able? like line wrap on each row, record or something? that
> way you can easily find the differences of each dump if need be?
No, but there are database comparison tools to do that, pgdiff being one
of them:
http://pgdiff.sourceforge.net/
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-20 19:47 Caleb Cushing <xenoterracide@gmail.com>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 8+ messages in thread
From: Caleb Cushing @ 2009-03-20 19:47 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-admin
On Fri, Mar 20, 2009 at 10:31 AM, Bruce Momjian <bruce@momjian.us> wrote:
>
> No, but there are database comparison tools to do that, pgdiff being one
> of them:
after reading a bit on it (docs seem a bit light but I also looked at
the mysql one), I don't think it solves my problem at all. it solves a
similar one. the way it reads suggests I have access to both
databases, I don't. I only have access to 1 (set up on my box from the
dump) and the dump from the other.
at work we dump our databases and add them to the git repository. and
pass the source back and forth, (I think it's a bit inefficient, but
I'm not the boss).
the problem is 2 fold, 1 it's impossible to get a human readable dump
diff, 2 the same reason is going to 'cause the git repository to get
large than it should because it stores blobs and these long lines
would each end up as a blob even though the character difference might
be like 1 character.
I suppose I could write a regex script that reformats the dump,
personally that scares me a bit.
it'd be great if pg could have the option to dump in a more 'diff-able' way.
--
Caleb Cushing
http://xenoterracide.blogspot.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-21 04:58 Tom Lane <tgl@sss.pgh.pa.us>
parent: Caleb Cushing <xenoterracide@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2009-03-21 04:58 UTC (permalink / raw)
To: Caleb Cushing <xenoterracide@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-admin
Caleb Cushing <xenoterracide@gmail.com> writes:
> it'd be great if pg could have the option to dump in a more 'diff-able' way.
What exactly do you find un-diffable about it?
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-22 04:26 Caleb Cushing <xenoterracide@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: Caleb Cushing @ 2009-03-22 04:26 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-admin
On Sat, Mar 21, 2009 at 12:58 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> What exactly do you find un-diffable about it?
after doing a bit of testing to be more explicit... pg isn't half as
bad as mysql, so I've mostly been asking about something that doesn't
apply...
however, it seems that it creates 1 line per row, and although this is
much better than mysql's behavior. for larger tables or fields this
would still be a bit harder to diff.
COPY blarg (blah, bleh, blerg) FROM stdin;
1 random character data
djfa;djjf;sdjl;afkjeoiuoiejk,cxjueiojiojeef98hkjdyf98y92hvniay8syfkdnf38932hrhf9e83uifnskjjjjjj3h9r83hhjnnn2iyfhkjsndfi7y938hnksu879hf089h3n299ssdjfh923
the above in pg_dump is one line
it'd be easier to diff if it were say on 3, or best yet with the
exception of say, binary data or things that can't be wrapped, have
the data (for like text records) wrapped at 79 characters or maybe 78
with \ at the end or something...
mysql is much more abysmal, and I believe it puts the entire table on
one line... or some such insanity.
--
Caleb Cushing
http://xenoterracide.blogspot.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-22 08:10 Peter Eisentraut <peter_e@gmx.net>
parent: Caleb Cushing <xenoterracide@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Peter Eisentraut @ 2009-03-22 08:10 UTC (permalink / raw)
To: pgsql-admin; +Cc: Caleb Cushing <xenoterracide@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; Bruce Momjian <bruce@momjian.us>
On Sunday 22 March 2009 06:26:02 Caleb Cushing wrote:
> COPY blarg (blah, bleh, blerg) FROM stdin;
> 1 random character data
> djfa;djjf;sdjl;afkjeoiuoiejk,cxjueiojiojeef98hkjdyf98y92hvniay8syfkdnf38932
>hrhf9e83uifnskjjjjjj3h9r83hhjnnn2iyfhkjsndfi7y938hnksu879hf089h3n299ssdjfh92
>3
>
> the above in pg_dump is one line
>
> it'd be easier to diff if it were say on 3, or best yet with the
> exception of say, binary data or things that can't be wrapped, have
> the data (for like text records) wrapped at 79 characters or maybe 78
> with \ at the end or something...
Maybe wdiff will do what you want.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-22 14:44 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter Eisentraut <peter_e@gmx.net>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2009-03-22 14:44 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-admin@postgresql.org, Caleb Cushing <xenoterracide@gmail.com>; Bruce Momjian <bruce@momjian.us>
Peter Eisentraut <peter_e@gmx.net> writes:
> On Sunday 22 March 2009 06:26:02 Caleb Cushing wrote:
>> COPY blarg (blah, bleh, blerg) FROM stdin;
>> 1 random character data
>> djfa;djjf;sdjl;afkjeoiuoiejk,cxjueiojiojeef98hkjdyf98y92hvniay8syfkdnf38932
>> hrhf9e83uifnskjjjjjj3h9r83hhjnnn2iyfhkjsndfi7y938hnksu879hf089h3n299ssdjfh92
>> 3
>>
>> the above in pg_dump is one line
>>
>> it'd be easier to diff if it were say on 3, or best yet with the
>> exception of say, binary data or things that can't be wrapped, have
>> the data (for like text records) wrapped at 79 characters or maybe 78
>> with \ at the end or something...
> Maybe wdiff will do what you want.
I don't think we'd consider making the kind of changes to the COPY
specification that would be needed to allow this sort of thing in COPY
mode. However, it'd be pretty trivial to put \n instead of space
between fields in the INSERT dump formats. I wonder whether that would
answer the need ...
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pg_dump formatting
@ 2009-03-22 17:09 Tom Lane <tgl@sss.pgh.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 8+ messages in thread
From: Tom Lane @ 2009-03-22 17:09 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; pgsql-admin@postgresql.org, Caleb Cushing <xenoterracide@gmail.com>; Bruce Momjian <bruce@momjian.us>
I wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> Maybe wdiff will do what you want.
> I don't think we'd consider making the kind of changes to the COPY
> specification that would be needed to allow this sort of thing in COPY
> mode. However, it'd be pretty trivial to put \n instead of space
> between fields in the INSERT dump formats. I wonder whether that would
> answer the need ...
On further reflection I think Peter's suggestion is better. It's not
hard to think of cases where a data-value-per-line format is *less*
useful not more so for diff-ing, because you lose all sense that a
table row is one logical unit. What the OP seems to be concerned about
is insertion/modification/deletion of words within fairly long data
fields. wdiff is ideal for that problem, while simply breaking at field
boundaries wouldn't help all that much.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2009-03-22 17:09 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-03-20 04:35 pg_dump formatting Caleb Cushing <xenoterracide@gmail.com>
2009-03-20 14:31 ` Bruce Momjian <bruce@momjian.us>
2009-03-20 19:47 ` Caleb Cushing <xenoterracide@gmail.com>
2009-03-21 04:58 ` Tom Lane <tgl@sss.pgh.pa.us>
2009-03-22 04:26 ` Caleb Cushing <xenoterracide@gmail.com>
2009-03-22 08:10 ` Peter Eisentraut <peter_e@gmx.net>
2009-03-22 14:44 ` Tom Lane <tgl@sss.pgh.pa.us>
2009-03-22 17:09 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox