X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4BBC5280B for ; Tue, 14 Jun 2005 23:06:19 -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 47047-03 for ; Wed, 15 Jun 2005 02:06:17 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 934855289A for ; Tue, 14 Jun 2005 23:06:15 -0300 (ADT) Received: (qmail 15277 invoked from network); 15 Jun 2005 02:06:20 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 15 Jun 2005 02:06:20 -0000 From: "Greg Sabino Mullane" To: pgsql-sql@postgresql.org Cc: twanger@bluetwanger.de Cc: twanger@bluetwanger.de Subject: Re: getting details about integrity constraint violation X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <1118728010.7429.0.camel@localhost.localdomain> Date: Wed, 15 Jun 2005 02:06:20 -0000 X-Mailer: JoyMail 1.48 Message-ID: <93b83a5f4f948719c40b2ecac346c692@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.13 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/165 X-Sequence-Number: 21766 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> Simply name the table constraints yourself with a descriptive name, so you >> always know exactly what is going on: > And then I keep a list of all the constraint names and scan the error > message for it? Don't keep a list: just come up with a standard naming scheme, such as: "tablename|colname|is_not_unique" which should be human and machine parseable (perl example): if ($error =~ m#^(.+)\|(.+)\|is_not_unique$#o) { die qq{Whoops : looks like column "$2" of table "$1" needs to be unique\n}; } - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200506142204 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFCr4zivJuQZxSWSsgRAgGPAJ0awkoBmus6z1cLBRpsR5xmQPTfiACgpJxG Ld90hEGDPrebBE3JGGL11L4= =smQJ -----END PGP SIGNATURE-----