Skip site navigation (1) Skip section navigation (2)

Re: ENUM type

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>,Jochem van Dieten <jochemd(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ENUM type
Date: 2005-07-27 15:30:10
Message-ID: 42E7A882.5020900@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-advocacypgsql-hackers

Tom Lane wrote:

>"Jim C. Nasby" <decibel(at)decibel(dot)org> writes:
>  
>
>>... what I was wondering about is creating a
>>'type' that is a rollup for:
>>    
>>
>
>  
>
>>- create parent table with int id field and text and indexes
>>- add RI to base table
>>- add triggers/views/rules/other glue to make the id field hidden and
>>  transparent to users in normal uses
>>    
>>
>
>Given the difficulties we've had with SERIAL columns, this seems much
>less than trivial :-(.  I'd be interested to see a good solution ---
>I suspect it needs one or two ideas we haven't had yet.
>
>In the meantime, I agree with Andrew's reply that the best stopgap is to
>invent a bespoke datatype for each required ENUM set, with input and
>output functions that have the list of values hardwired in.
>
>
>  
>

:-)

Can you expand a bit on how it might work? It's not totally clear to me 
:-)  Can we use an incomplete type as a parameter for anything except a 
C function? Maybe we could do it with a single C function that would 
retrieve the values from the catalog (extra col in pg_type?) and build 
(and cache) the translation tables.


This could be an excellent intern project, BTW.

cheers

andrew



In response to

pgsql-hackers by date

Next:From: Josh BerkusDate: 2005-07-27 16:40:27
Subject: Re: ENUM type
Previous:From: Bruno Wolff IIIDate: 2005-07-27 15:26:44
Subject: Re: Interesting COPY edge case...

pgsql-advocacy by date

Next:From: Josh BerkusDate: 2005-07-27 16:40:27
Subject: Re: ENUM type
Previous:From: Alexey BorzovDate: 2005-07-27 13:08:40
Subject: Re: [HACKERS] Enticing interns to PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group