X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF19A9DC840 for ; Thu, 29 Dec 2005 13:48:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66908-04 for ; Thu, 29 Dec 2005 13:48:44 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from 10.hostcorporate.com (unknown [69.41.231.186]) by postgresql.org (Postfix) with SMTP id A32749DC817 for ; Thu, 29 Dec 2005 13:48:31 -0400 (AST) Received: (qmail 15362 invoked from network); 29 Dec 2005 17:26:04 -0000 Received: from localhost (HELO localhost.localdomain) (127.0.0.1) by 10.hostcorporate.com with SMTP; 29 Dec 2005 17:26:04 -0000 Message-ID: <43B4216A.3080707@zara.6.isreserved.com> Date: Fri, 30 Dec 2005 00:48:26 +0700 From: David Garamond User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 CC: pgsql-sql@postgresql.org Subject: Re: constraint and ordered value References: <43B17F52.7000305@zara.6.isreserved.com> <20051229071625.GA2815@wolff.to> <0BC6CA83-B17E-47CC-8438-013D6B7348ED@eddl.us> In-Reply-To: <0BC6CA83-B17E-47CC-8438-013D6B7348ED@eddl.us> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.214 required=5 tests=[AWL=0.025, MISSING_HEADERS=0.189] X-Spam-Score: 0.214 X-Spam-Level: X-Archive-Number: 200512/241 X-Sequence-Number: 23783 Daryl Richter wrote: >> No. A constraint only applies to one row at a time. If you try to >> work around >> this by calling a function that does queries it isn't guarenteed to >> work. >> And if you are thinking of calling a function that does a query, you >> aren't >> looking at saving time over using triggers. >> >> Also, if you are going to have concurrent updates, you are going to >> need to >> do table locking to make this work. > > And, finally, you should ask yourself *why* are you doing this, given > that one of the fundamental properties of a table (relation) is that > the rows (tuples) are *unordered.* So much of what makes a relational > db a wonderful thing for storing data depends on this notion. > > If you provide an explanation of what you are trying to model, perhaps > we can help you find a better schema design. Thanks for the insightful answers. Actually I'm just learning about and trying out CHECK constraints in Postgres (and Firebird) :-) Regards, dave