X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F33275297E for ; Wed, 29 Jun 2005 05:43:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91955-06 for ; Wed, 29 Jun 2005 08:43:50 +0000 (GMT) Received: from hetzner.co.za (lfw.hetzner.co.za [196.7.18.226]) by svr1.postgresql.org (Postfix) with ESMTP id A12175299F for ; Wed, 29 Jun 2005 05:43:48 -0300 (ADT) Received: from localhost ([127.0.0.1]) by hetzner.co.za with esmtp (Exim 4.50 (FreeBSD)) id 1DnYAd-0004Bl-Rg; Wed, 29 Jun 2005 10:43:47 +0200 To: Scott Marlowe Cc: pgsql-admin@postgresql.org From: Ian FREISLICH Subject: Re: How to compare the schemas ? In-reply-to: Your message of "Tue, 28 Jun 2005 10:41:33 EST." <1119973293.8208.107.camel@state.g2switchworks.com> X-Attribution: BOFH Date: Wed, 29 Jun 2005 10:43:47 +0200 Message-Id: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.44 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200506/271 X-Sequence-Number: 18026 Scott Marlowe wrote: > > COMMENT ON FUNCTION namedConfGen(TEXT,TEXT) IS '$Id: sproc.api.namedConfGen ,v 1. > > 8 2004/05/07 08:02:55 ianf Exp $'; > > > > Now I can cvs diff using the version numbers. Not ideal, but at > > least I know exactly where I am. > > I just pass a schema backup through grep or sed with this option: > > grep -Pv "^--" > > and get a pretty good idea of the differences. > > Since our databases are created by scripts as well, they generally share > creation order and such, so any small difference from missing a script > on one or another environment shows up with this. Yes, I've done that too, but grepping for the comments which have the CVS ID. Both can be sorted so you get a reasonable diff. However, if the creation order is different, then a straight diff of the full schema dumps is useless. I see that there is a way to dump a single table 'pg_dump -t table' so you could dump a table at a time and diff the individual tables. I see that there is no similar option for functions, triggers, types and opperators (have I left anything out?). Then these dumps could be entirely scripted and usefull diff output could be obtained. I guess I could write a perl function to dump the relevant bits of the information schema in a way that will diff nicely. I'll look into that next time I need to do this. Ian -- Ian Freislich