On Fri, Apr 15, 2005 at 08:42:45AM +0100, Dave Page wrote:
> [pgsql-slavestothewww] Comment 2333 added to page install-upgrading.html of 
> version 7.4
> Author: Shayne Hardesty <[EMAIL PROTECTED]>
> ----
> If you use pg_dump on an older version (say 7.1.x, 7.2.x, or 7.3.x) you will 
> get complains from psql about carriage returns must be represented as literal 
> \r.  The workaround for this is to use the -d argument with pg_dump to dump 
> as insert statements, but that makes restore ungodly slow (prohibitively slow 
> in my case).  In one data test I did the restore took 4 days - not workable 
> for a production SQL environment.
> 
> The solution I found was to put together a perl script to clean the output of 
> "pg_dump <<dbname>> > <<file>>" to change carriage returns to \r.  I'm 
> sharing my script here in hopes someone finds it useful.
> 
> -- BEGIN clean-pgdump.pl --
> #!/usr/bin/perl -w
> 
> use strict;
> 
> my $file = shift @ARGV || '';
> die "no input file specified\n" unless $file;
> 
> open(FILE, $file) || die "cannot read file: $!\n";
> while (<FILE>) {
>    s'\r\\\n'\\r'go;
>    s'\r'\\r'go;
> 
>    print;
> }
> close(FILE);
> 
> exit;
> -- END clean-pgdump.pl --
> 
> Execute the script with ./clean-pgdump.pl <<file>> > <<newfile>>
> Then run "psql -d template1 -f <<newfile>>" to import

I think this comment is a good example of a problem with the current
system; this comment applies to both 7.4 and 8.0, but it's only in the
7.4 version. It's also long enough that it might not get into the
mainline docs (though I'm completely guessing there). It would be useful
if there was a way to have a comment cross versions.
-- 
Jim C. Nasby, Database Consultant               [EMAIL PROTECTED] 
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?"

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to