X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7C927D1B498 for ; Wed, 26 Nov 2003 11:46:47 +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 26357-07 for ; Wed, 26 Nov 2003 07:46:19 -0400 (AST) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 42E27D1B475 for ; Wed, 26 Nov 2003 07:46:16 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1AOy7e-0003yx-0V; Wed, 26 Nov 2003 11:46:18 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id E06BB17A25; Wed, 26 Nov 2003 11:46:11 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 263D716DAD; Wed, 26 Nov 2003 11:46:10 +0000 (GMT) From: Richard Huxton To: Kaloyan Iliev Iliev , pgsql-sql@postgresql.org Subject: Re: Unsigned numbers Date: Wed, 26 Nov 2003 11:46:08 +0000 User-Agent: KMail/1.5 References: <3FC48A26.1090407@faith.digsys.bg> In-Reply-To: <3FC48A26.1090407@faith.digsys.bg> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200311261146.08737.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/288 X-Sequence-Number: 16103 On Wednesday 26 November 2003 11:10, Kaloyan Iliev Iliev wrote: > Hello Friends, > > I have the following questions. > I have a lot of fields in my database that are int or float. > The problem is that I need them to be only positive (unsigned) and the > users try to insert sometimes negative. [snip - problem is that errors give constraint name] > Are there any unsigned data types like unsigned int or unsigned float. > Can I make a domain or something like that (How exactly to add > constraint to domain). > I am using v7.3.2. Adding CHECKs to domains is new for 7.4, I believe. There aren't any built-in unsigned types, although in theory you could write your own. What I do is format my constraint names in a known way. So, a check on table foo, column bar might be called "foo_bar_positive" - then I can get the information I want from the constraint name. -- Richard Huxton Archonet Ltd