Re: Interactive docs idea

From: Jim C. Nasby
Subject: Re: Interactive docs idea
Date: ,
Msg-id: 20050415155236.GR58835@decibel.org
(view: Whole thread, Raw)
In response to: Re: Interactive docs idea  ("Dave Page")
List: pgsql-hackers

Tree view

Interactive docs idea  (Christopher Kings-Lynne, )
 Re: Interactive docs idea  (Alvaro Herrera, )
  Re: Interactive docs idea  (Greg Stark, )
   Re: Interactive docs idea  (Christopher Kings-Lynne, )
    Re: Interactive docs idea  (Andrew Dunstan, )
 Re: Interactive docs idea  ("Dave Page", )
  Re: Interactive docs idea  (Robert Treat, )
   Re: Interactive docs idea  (Alvaro Herrera, )
  Re: Interactive docs idea  (Greg Stark, )
   Re: Interactive docs idea  (Alvaro Herrera, )
    Re: Interactive docs idea  (Greg Stark, )
     Re: Interactive docs idea  (Alvaro Herrera, )
      Re: Interactive docs idea  (Greg Stark, )
   Re: Interactive docs idea  ("Joshua D. Drake", )
 Re: Interactive docs idea  ("Dave Page", )
  Re: Interactive docs idea  ("Jim C. Nasby", )

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 <>
> ----
> 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
returnsmust be represented as literal \r.  The workaround for this is to use the -d argument with pg_dump to dump as
insertstatements, but that makes restore ungodly slow (prohibitively slow in my case).  In one data test I did the
restoretook 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
changecarriage 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                
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?"



pgsql-hackers by date:

From: "Magnus Hagander"
Date:
Subject: Re: Kerberos patch in the queue
From: Andrew Sullivan
Date:
Subject: Praise (was: [ADMIN] is postgresql 8 is realy mature)