Thread: Mention pg_dump version portability

Mention pg_dump version portability

From
Bruce Momjian
Date:
I have applied this patch that mentions pg_dump portability to 8.1.X and
CVS HEAD.

--
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: pg_dump.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v
retrieving revision 1.84
diff -c -r1.84 pg_dump.sgml
*** pg_dump.sgml    6 May 2006 23:25:37 -0000    1.84
--- pg_dump.sgml    13 May 2006 16:19:04 -0000
***************
*** 645,650 ****
--- 645,661 ----
     ensure good performance.
    </para>

+   <para>
+    Because <application>pg_dump</application> is used to tranfer data
+    to newer versions of <productname>PostgreSQL</>, the output of
+    <application>pg_dump</application> can be loaded into
+    newer versions of <productname>PostgreSQL</>.  It also can read older
+    <productname>PostgreSQL</> databases.  However, it usually cannot
+    read newer <productname>PostgreSQL</> databases or produce dump output
+    that can be loaded into older database versions.  To do this, manual
+    editing of the dump file might be required.
+   </para>
+
   </refsect1>

   <refsect1 id="pg-dump-examples">

Re: Mention pg_dump version portability

From
"Jim C. Nasby"
Date:
On Sat, May 13, 2006 at 12:21:06PM -0400, Bruce Momjian wrote:
> I have applied this patch that mentions pg_dump portability to 8.1.X and
> CVS HEAD.

Would it be worth recommending using the custom format over plain? I see
plenty of issues with incompatabilities in the plain version, but I
don't think I've ever seen problem with the custom format (though this
could just be because everyone uses the default...)
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

Re: Mention pg_dump version portability

From
Bruce Momjian
Date:
Jim C. Nasby wrote:
> On Sat, May 13, 2006 at 12:21:06PM -0400, Bruce Momjian wrote:
> > I have applied this patch that mentions pg_dump portability to 8.1.X and
> > CVS HEAD.
>
> Would it be worth recommending using the custom format over plain? I see
> plenty of issues with incompatabilities in the plain version, but I
> don't think I've ever seen problem with the custom format (though this
> could just be because everyone uses the default...)

Right, it is just because it is the default.

--
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Mention pg_dump version portability

From
"Jim C. Nasby"
Date:
On Mon, May 15, 2006 at 07:43:20PM -0400, Bruce Momjian wrote:
> Jim C. Nasby wrote:
> > On Sat, May 13, 2006 at 12:21:06PM -0400, Bruce Momjian wrote:
> > > I have applied this patch that mentions pg_dump portability to 8.1.X and
> > > CVS HEAD.
> >
> > Would it be worth recommending using the custom format over plain? I see
> > plenty of issues with incompatabilities in the plain version, but I
> > don't think I've ever seen problem with the custom format (though this
> > could just be because everyone uses the default...)
>
> Right, it is just because it is the default.

But shouldn't the custom format deal better with version changes, or
does the format of custom change just as often? Though, even if it did
change just as often, pg_restore should be able to deal better with it
than psql, since pg_restore knows it's a dump and knows what version
it's coming from...
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

Re: Mention pg_dump version portability

From
Tom Lane
Date:
"Jim C. Nasby" <jnasby@pervasive.com> writes:
> But shouldn't the custom format deal better with version changes, or
> does the format of custom change just as often?

It's completely orthogonal, because the SQL involved is just the same.
One of the tests I periodically run is to compare
    pg_dump >foo
    pg_dump -Fc | pg_restore >bar
and make sure the outputs are word-for-word the same.

What custom or tar format buys you is the flexibility of extracting
different subsets of the dump after-the-fact, using pg_restore's
switches.  Of course you can do that with a text editor on a plain
dump, if the dump's not too large for your editor to handle ...

            regards, tom lane

Re: Mention pg_dump version portability

From
"Jim C. Nasby"
Date:
Grr, deleted Tom's email before I replied...

pg_dump -Fc | pg_restore will only match the output of pg_dump if
everything's the same version though, right? Or wrong? What happens if
pg_dump -Fc is and older version and pg_restore is the current version?

Or is the custom format the same as the text/SQL dump, just with some
fancy wrappers around it?
--
Jim C. Nasby, Database Architect                decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

Re: Mention pg_dump version portability

From
Tom Lane
Date:
"Jim C. Nasby" <decibel@decibel.org> writes:
> pg_dump -Fc | pg_restore will only match the output of pg_dump if
> everything's the same version though, right? Or wrong? What happens if
> pg_dump -Fc is and older version and pg_restore is the current version?

There would probably be some small differences, but 99% of pg_restore's
output is just regurgitating SQL it finds in the dump file.

            regards, tom lane