Re: [HACKERS] pg_dump not dumping all tables

Hannu Krosing <hannu@trust.ee>

From: Hannu Krosing <hannu@trust.ee>
To: The Hermit Hacker <scrappy@hub.org>
Cc: "G. Anthony Reina" <reina@nsi.edu>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgreSQL.org
Date: 1999-07-29T06:04:12Z
Lists: pgsql-hackers
The Hermit Hacker wrote:
> 
> On Wed, 28 Jul 1999, G. Anthony Reina wrote:
> 
> > Again, the text file is over 2 Gig so I can't seem to find an editor that is
> > big enough to hold it all in memory (I only have a half a gig of RAM). So it
> > really is just guesswork. Anything you can think of to strip the data from
> > this big of a file?
> 
> egrep "^CREATE|^COPY" <filename> ?

Nay,we have currently nice multi-line CREATEs.

the following python script should to work

------------------------------------------------------
#!/usr/bin/env python
 
import sys
 
in_data = 0
 
while 1:
    line = sys.stdin.readline()
    if not line: break
    if line[:5] == 'COPY ':
        in_data = 1
    if not in_data: sys.stdout.write(line)
    if in_data and line[:2] == '\\.':
        in_data = 0
-----------------------------------------------------

as you can probably guess it is used as 

stripdata.py <withdata.sql >withoutdata.sql

-------------------------
Hannu