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 20840529CB for ; Wed, 29 Jun 2005 10:21:20 -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 56135-05 for ; Wed, 29 Jun 2005 13:21:15 +0000 (GMT) Received: from n7.gigared.com (smtp1.gigared.com [200.68.216.7]) by svr1.postgresql.org (Postfix) with ESMTP id DE64552992 for ; Wed, 29 Jun 2005 10:21:13 -0300 (ADT) Received: from [10.41.138.237] (unknown [10.41.138.237]) by n7.gigared.com (Postfix) with ESMTP id 0305C86E8F for ; Wed, 29 Jun 2005 10:20:24 -0300 (GMT) From: =?iso-8859-15?q?Mart=EDn_Marqu=E9s?= To: pgsql-sql@postgresql.org Subject: Re: ENUM like data type Date: Wed, 29 Jun 2005 10:21:10 -0300 User-Agent: KMail/1.7.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200506291021.10986.martin@bugs.unl.edu.ar> X-Gigared-MailScanner-Information: MailScanner: Found to be clean X-MailScanner-From: martin@bugs.unl.edu.ar X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.636 tagged_above=0 required=5 tests=INVALID_TZ_GMT X-Spam-Level: X-Archive-Number: 200506/355 X-Sequence-Number: 21956 El Mi=E9 29 Jun 2005 09:40, K=D6PFERL Robert escribi=F3: >=20 > | > |I personally think that the ENUM data type is for databases=20 > |that are not well=20 > |designed. So, if you see the need for ENUM, that means you=20 > |need to re-think=20 > |your data design. > | >=20 > I disagree. In several relations (views of the world) one needs to have a > hand full of well defined values while > integers or bools are not appropriate and strings are too free form. > For example male female or true and false. Whilst the second has a well > known type, other things like a telephone number type don't have such typ= e. > So a new one should be created instead of (varchar/ xy between 4 and 8). = One > might argue that new 1:n relations with integrity shall be established but > this is in my eyes overkill for a constant number of values. > Also think of schema export without data. These values are part of the > schema data but not the schema itself which in this sense is wrong Please, most of this can be done with CHECK(...). =2D-=20 select 'mmarques' || '@' || 'unl.edu.ar' AS email; =2D-------------------------------------------------------- Mart=EDn Marqu=E9s | Programador, DBA Centro de Telem=E1tica | Administrador Universidad Nacional del Litoral =2D--------------------------------------------------------