X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F00E59DC805 for ; Mon, 27 Feb 2006 05:04:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83828-01 for ; Mon, 27 Feb 2006 05:04:37 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.hive.is (scania.ipf.is [85.197.192.147]) by postgresql.org (Postfix) with SMTP id 6AC8E9DC818 for ; Mon, 27 Feb 2006 05:04:33 -0400 (AST) Received: (qmail 54046 invoked by uid 1010); 27 Feb 2006 09:04:38 -0000 Received: from 85.197.216.186 by scania.ipf.is (envelope-from , uid 1009) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1283. spamassassin: 3.1.0. perlscan: 1.25-st-qms. Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 0.342461 secs); 27 Feb 2006 09:04:38 -0000 X-Antivirus-HIVE-Mail-From: gnari@hive.is via scania.ipf.is X-Antivirus-HIVE: 1.25-st-qms (Clear:RC:1(85.197.216.186):SA:0(-4.1/4.0):. Processed in 0.342461 secs Process 54035) Received: from dsl-216-186.hive.is (HELO ?192.168.1.34?) (85.197.216.186) by mx1.hive.is with SMTP; 27 Feb 2006 09:04:37 -0000 Subject: Re: Dump/restore comments only? From: Ragnar To: dave.bath@unix.net Cc: pgsql-sql@postgresql.org In-Reply-To: <200602271356.18537.dave.bath@unix.net> References: <200602271356.18537.dave.bath@unix.net> Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 27 Feb 2006 09:04:32 +0000 Message-Id: <1141031072.8396.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.155 required=5 tests=[AWL=0.155] X-Spam-Score: 0.155 X-Spam-Level: X-Archive-Number: 200602/323 X-Sequence-Number: 24333 On mán, 2006-02-27 at 13:56 +1100, Bath, David wrote: > There have been a number of times when I've wanted to ignore everything > in a dump file apart from comments. I am interested not just in comments > for tables/views/columns but constraints, indices and functions as well. > > Many of my comments are multi-line and often resemble manpages, so a > simple grep for '^COMMENT ON' will not work for me. > > Has anyone got a script/view in SQL that will generate fully-qualified > COMMENT ON statements from the pg_catalog/information_schema, a > sed|awk|perl script to munge the ascii file produced by pg_dump, > or even pg_dump undocumented options that might help me? You might find it simpler to do this if you use the custom format. Something like : pg_dump -Fc mydat > mydat.dump pg_restore -l mydat.dump > mydat.toc grep COMMENT mydat.toc > mydat.comments.toc pgrestore -L mydat.comments.toc mydat.dump gnari