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 46991D1B523; Wed, 29 Oct 2003 10:59:26 +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 89751-07; Wed, 29 Oct 2003 06:58:56 -0400 (AST) Received: from ucsns.ucs.co.za (ucs.co.za [196.23.43.2]) by svr1.postgresql.org (Postfix) with ESMTP id A4F53D1B529; Wed, 29 Oct 2003 06:58:17 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by ucsns.ucs.co.za (Postfix) with ESMTP id DD4F32BDD7; Wed, 29 Oct 2003 12:57:58 +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 08967-05; Wed, 29 Oct 2003 12:57:58 +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 F13A62BDD4; Wed, 29 Oct 2003 12:57:57 +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 091DAD9F01; Wed, 29 Oct 2003 12:57:58 +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 E29C3976E3; Wed, 29 Oct 2003 12:57:56 +0200 (SAST) Date: Wed, 29 Oct 2003 12:57:52 +0200 From: Stef To: pgsql-admin@postgresql.org, pgsql-sql@postgresql.org Subject: Table versions Message-Id: <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_12_57_52_+0200_3=FmPbV_FA4nzzJ+" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/346 X-Sequence-Number: 10907 --Signature=_Wed__29_Oct_2003_12_57_52_+0200_3=FmPbV_FA4nzzJ+ Content-Type: multipart/mixed; boundary="Multipart=_Wed__29_Oct_2003_12_57_52_+0200_CMNYie2j7gRT6dpG" --Multipart=_Wed__29_Oct_2003_12_57_52_+0200_CMNYie2j7gRT6dpG Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit 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 --Multipart=_Wed__29_Oct_2003_12_57_52_+0200_CMNYie2j7gRT6dpG Content-Type: application/octet-stream; name="test.plpgsql" Content-Disposition: attachment; filename="test.plpgsql" Content-Transfer-Encoding: base64 Q1JFQVRFIG9yIHJlcGxhY2UgRlVOQ1RJT04gaW5jcmVtZW50X3RhYmxlX3Zl cnNpb24gKCkgUkVUVVJOUyBPUEFRVUUgQVMgJwogICAgREVDTEFSRSAKICAg ICAgIHZfbmV3X3ZlcnNpb24gaW50NDsKICAgIEJFR0lOCiAgICAKICAgICAg IHNlbGVjdCBpbnQ0KGRlc2NyaXB0aW9uKSBpbnRvIHZfbmV3X3ZlcnNpb24g ZnJvbSBwZ19kZXNjcmlwdGlvbiAKICAgICAgIHdoZXJlIG9iam9pZCA9IE5F Vy5hdHRyZWxpZDsKICAgICAgIAogICAgICAgdXBkYXRlIHBnX2Rlc2NyaXB0 aW9uIHNldCBkZXNjcmlwdGlvbiA9IHZfbmV3X3ZlcnNpb24gd2hlcmUgb2Jq b2lkID0gTkVXLmF0dHJlbGlkOwoKICAgICAgIHJldHVybiBORVc7CiAgICBF TkQ7CicgTEFOR1VBR0UgJ3BscGdzcWwnOwo= --Multipart=_Wed__29_Oct_2003_12_57_52_+0200_CMNYie2j7gRT6dpG Content-Type: application/octet-stream; name="test.trigger" Content-Disposition: attachment; filename="test.trigger" Content-Transfer-Encoding: base64 Q1JFQVRFIFRSSUdHRVIgdGFibGVfdmVyc2lvbl9pbmNyZW1lbnQgQkVGT1JF IElOU0VSVCBPUiBVUERBVEUgb24gcGdfYXR0cmlidXRlCkZPUiBFQUNIIFJP VyBFWEVDVVRFIFBST0NFRFVSRSBpbmNyZW1lbnRfdGFibGVfdmVyc2lvbigp Owo= --Multipart=_Wed__29_Oct_2003_12_57_52_+0200_CMNYie2j7gRT6dpG-- --Signature=_Wed__29_Oct_2003_12_57_52_+0200_3=FmPbV_FA4nzzJ+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/n501gDYs3UkRjZkRAgpFAJ0eUF7z51Cy6pof7HavuB4wzbUgDwCgiBua H2XNIKSxXTOtYWBbTs1pzbw= =2YjD -----END PGP SIGNATURE----- --Signature=_Wed__29_Oct_2003_12_57_52_+0200_3=FmPbV_FA4nzzJ+--