X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 83B8B9FA4A5 for ; Thu, 29 Jun 2006 10:47:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 94028-10 for ; Thu, 29 Jun 2006 10:47:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 789309FA081 for ; Thu, 29 Jun 2006 10:47:02 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5TDl0Xx020098; Thu, 29 Jun 2006 09:47:00 -0400 (EDT) To: rodrigo.sakai@zanthus.com.br cc: pgsql-interfaces@postgresql.org Subject: Re: RES: Creating a new type In-reply-to: <000001c69b78$e5cfcee0$4700a8c0@TREEZANTHUS> References: <000001c69b78$e5cfcee0$4700a8c0@TREEZANTHUS> Comments: In-reply-to "Rodrigo Sakai" message dated "Thu, 29 Jun 2006 09:38:17 -0300" Date: Thu, 29 Jun 2006 09:47:00 -0400 Message-ID: <20097.1151588820@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/46 X-Sequence-Number: 6187 "Rodrigo Sakai" writes: > So, I have to guarantee that this situation doesn't occur! But I don't > want to use triggers because this check must be done on almost all tables > that uses the type: The fact that you don't want to do it doesn't make it the wrong solution ;-) At the moment there is no other way than a trigger. There's been some speculation about whether GIST indexes could be extended to enforce conditions like "no overlapping values in this column" (as a generalization of the concept of unique indexes). No one's tried to make that happen, though. BTW, you might want to look at the "timetravel" code in contrib/spi/ ... it's a tad old and crufty, but it sounds like you are trying to do something pretty similar to that. regards, tom lane