X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C47DDD1B561; Wed, 29 Oct 2003 11:22:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 98241-08; Wed, 29 Oct 2003 07:21:50 -0400 (AST) Received: from ucsns.ucs.co.za (ucs.co.za [196.23.43.2]) by svr1.postgresql.org (Postfix) with ESMTP id CEFDCD1B508; Wed, 29 Oct 2003 07:21:46 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by ucsns.ucs.co.za (Postfix) with ESMTP id CDDD22BD43; Wed, 29 Oct 2003 13:21:45 +0200 (SAST) Received: from ucsns.ucs.co.za ([127.0.0.1]) by localhost (ucsns.ucs.co.za [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09606-04; Wed, 29 Oct 2003 13:21:44 +0200 (SAST) Received: from ucspost.ucs.co.za (mailgw1.ucs.co.za [196.23.43.253]) by ucsns.ucs.co.za (Postfix) with ESMTP id 6A99A2BDD1; Wed, 29 Oct 2003 13:21:44 +0200 (SAST) Received: from jhb.ucs.co.za (jhb.ucs.co.za [172.31.1.3]) by ucspost.ucs.co.za (Postfix) with ESMTP id A7F55D9F01; Wed, 29 Oct 2003 13:21:45 +0200 (SAST) Received: from svb.ucs.co.za (svb.ucs.co.za [172.31.1.148]) by jhb.ucs.co.za (Postfix) with SMTP id 6FF90976E3; Wed, 29 Oct 2003 13:21:44 +0200 (SAST) Date: Wed, 29 Oct 2003 13:21:33 +0200 From: Stef To: Stef Cc: pgsql-admin@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [SQL] Table versions Message-Id: <20031029132133.308ccd0e.svb@ucs.co.za> In-Reply-To: <20031029125752.35069e3b.svb@ucs.co.za> References: <20031029125752.35069e3b.svb@ucs.co.za> X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i386-pc-linux-gnu) User-Agent: sillypheed-claws (anti-aliased) X-Face: LV^-*d3kQlL,6{Y:X)M~tuL#y!p.kO_Qbc!xxqhZC4s}Y]L0g)z^aiLsQGY34d|}Xp:HNm)MRsc?^?ZQ}smznF&jx|w@,a**K&QL.Dc~2~M5V`zb>hExCJDB[[o=M)e"; k-n[7tz2TY7+; *_xX's(5cUEtdw*yG-OmKm}6($zpUz8S`Nz@w X-Operating-System: sid X-X-X: _-^-_ Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Signature=_Wed__29_Oct_2003_13_21_33_+0200_coy52aO_Fwv=hs4F" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/347 X-Sequence-Number: 10908 --Signature=_Wed__29_Oct_2003_13_21_33_+0200_coy52aO_Fwv=hs4F Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit Correction on the function : The function currently on the database did has select int4(description) + 1 into v_new_version from pg_description where objoid = NEW.attrelid; in stead of select int4(description) into v_new_version from pg_description where objoid = NEW.attrelid; ##START## => Hi all, => => I'm trying to create some kind of table version control => system for approximately 300 postgres databases => ranging in version from 7.1.2 to 7.3.4. => => I compared the "pg_dump -s" output between => the various versions of databases, but the format is inconsistent, => and I can't do diff's to check that table structures are identical => on the various databases this way. => => What I did next, is put a trigger on pg_attribute that should, in theory, => on insert and update, fire up a function that will increment a version => number on a table comment every time a table's structure is modified. => I tried to make the function update a comment on pg_description to => accomplish this. => => I'm having a lot of trouble doing this and testing it, and after plenty tries => it's still not working. I've attached the trigger statement and the plpgsql function. => (There might be a few mistakes, and I haven't attempted to cater for => system columns and multiple changes yet.) => => Can somebody please tell me if what I'm trying will ever work, or => maybe an alternative (easier) way to compare a specific table's => structure amongst various databases, that are not necessarily => on the same network, nor of the same version of postgres. => => Regards => Stefan => --Signature=_Wed__29_Oct_2003_13_21_33_+0200_coy52aO_Fwv=hs4F Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/n6LJgDYs3UkRjZkRAq63AKCuzvXmGvl2csOpAjeuPTLbE+RSZgCeMz7P D1YFH4VvueMlInA8hWN8Ypc= =dNk5 -----END PGP SIGNATURE----- --Signature=_Wed__29_Oct_2003_13_21_33_+0200_coy52aO_Fwv=hs4F--