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 E243E52A42 for ; Tue, 28 Jun 2005 13:58:46 -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 86435-01 for ; Tue, 28 Jun 2005 16:58:40 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id BD1BA529D2 for ; Tue, 28 Jun 2005 13:58:38 -0300 (ADT) Received: (qmail 3669 invoked from network); 28 Jun 2005 18:58:54 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 28 Jun 2005 18:58:54 +0200 To: "Mike Rylander" , pgsql-sql@postgresql.org Subject: Re: ENUM like data type References: <11bgc1oblfasq3d@corp.supernews.com> Message-ID: Date: Tue, 28 Jun 2005 18:58:32 +0200 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/340 X-Sequence-Number: 21941 >> Here is where I get uncertain as to if this is possible. My idea is to >> create a pseudo type that triggers the creation of it's lookup tables >> the same way the SERIAL type triggers creation of a sequence and returns >> an int with the right default value. Personnally I use one table which has columns (domain, name) and which stores all enum values for all different enums. I have then CHECK( is_in_domain( column, 'domain_name' )) which is a simple function which checks existence of the value in this domain (SELECT 1 FROM domains WHERE domain=$2 AND name=$1 LIMIT 1) for instance. You can also use integers.