Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible - Mailing list pgsql-general

From Michael A. Koerber SR
Subject Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible
Date
Msg-id 199905310008.UAA29212@ll.mit.edu
Whole thread Raw
In response to Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible  (Gregory Maxwell <greg@z.ml.org>)
Responses Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible  (Gregory Maxwell <greg@z.ml.org>)
List pgsql-general
I have had trouble on numerous occasions "undumping" a pg_dump.  Below is
a perl script that I use as a pipe for undumping...hope it helps

.....pg_undump.....
#!/usr/bin/perl -p

# This script is a pipe that is used to break up PSQL dumps into pieces
# that are more manageable by the postmaster.  If there are too many
# input lines, the memory used by the transaction block can easily
# choke the machine.

BEGIN { $MAXLINES = 1000; }

# Does the current input line define the beginning of an input block?
if (m/^COPY/) {
    # When a copy line is encountered grab the line for later use
    # and turn on the line counter;
    $copyline = $_;
    $cnt = 0;
}

# Does the current input line define the end of an input block?
if (m{^\\\.}) {
    # We have just macthed the end of STDIN line.  Set counter off
    undef $cnt;
}

# If we are in an input block and the count is at the max, "flush" the buffer
# and setup for the next block.
if (defined($cnt) and ($cnt > $MAXLINES) ) {
    $cnt = 0;
    print '\.', "\n";
    print $copyline;
}

$cnt++ if defined $cnt;

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible