Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible

From: "Michael A(dot) Koerber SR" <mak(at)ll(dot)mit(dot)edu>
To: greg(at)z(dot)ml(dot)org
Cc: olly(at)lfix(dot)co(dot)uk, pgsql-general(at)hub(dot)org
Subject: Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible
Date: 1999-05-31 00:07:11
Message-ID: 199905310008.UAA29212@ll.mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1999-05-31 00:25:47 Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible
Previous Message Chris Bitmead 1999-05-30 23:51:03 Re: [GENERAL] Upgrading from 6.3->6.4.2/6.5b1 possible