Re: [SQL] ENUM like data type

2005-06-30 Thread KÖPFERL Robert
| 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

Re: [SQL] ENUM like data type

2005-06-30 Thread Peter Eisentraut
Am Donnerstag, 30. Juni 2005 00:55 schrieb Tom Lane: It's not that hard to make your own type using the builtin textin and textout functions, and then add just the functions you wish to provide. Implementing the distinct type feature of SQL would probably amount to something like that. Might

Re: [SQL] ENUM like data type

2005-06-29 Thread Dawid Kuroczko
On 6/28/05, Martín Marqués martin@bugs.unl.edu.ar wrote: El Mar 28 Jun 2005 13:58, PFC escribió: 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

Re: [SQL] ENUM like data type

2005-06-29 Thread KÖPFERL Robert
| |I personally think that the ENUM data type is for databases |that are not well |designed. So, if you see the need for ENUM, that means you |need to re-think |your data design. | I disagree. In several relations (views of the world) one needs to have a hand full of well defined values

Re: [SQL] ENUM like data type

2005-06-29 Thread Martín Marqués
El Mié 29 Jun 2005 09:40, KÖPFERL Robert escribió: | |I personally think that the ENUM data type is for databases |that are not well |designed. So, if you see the need for ENUM, that means you |need to re-think |your data design. | I disagree. In several relations (views of the

Re: [SQL] ENUM like data type

2005-06-29 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: Rod Taylor wrote: Indeed. A CHECK constraint on a DOMAIN is an ENUM plus some. Not really. A domain doesn't create a new type. If you base your enum domains on the text type, as would usually be the case, then nothing stops you from using, say,

[SQL] ENUM like data type

2005-06-28 Thread MRB
Hi All, I have something in mind I'm not certain is do-able. I'm working with a lot of data from MySQL where the MySQL ENUM type is used. This is not a big problem per se but creating the proper lookup tables is becoming a bit tedious so I was hoping to make something better of it. Here is

Re: [SQL] ENUM like data type

2005-06-28 Thread Kenneth Gonsalves
On Tuesday 21 Jun 2005 8:50 pm, MRB wrote: I'm working with a lot of data from MySQL where the MySQL ENUM type is used. just a thought - it took me five years after migrating from mysql to pg to start thinking like an sql programmer. I used to keep trying to write stuff for pg 'like' i used

Re: [SQL] ENUM like data type

2005-06-28 Thread Bruno Wolff III
On Tue, Jun 21, 2005 at 17:20:19 +0200, MRB [EMAIL PROTECTED] wrote: 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

Re: [SQL] ENUM like data type

2005-06-28 Thread Martín Marqués
El Mar 28 Jun 2005 13:58, PFC escribió: 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

Re: [SQL] ENUM like data type

2005-06-28 Thread Scott Marlowe
On Tue, 2005-06-28 at 13:22, Martín Marqués wrote: El Mar 28 Jun 2005 13:58, PFC escribió: 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

Re: [SQL] ENUM like data type

2005-06-28 Thread Nick Johnson
Martín Marqués wrote: I personally think that the ENUM data type is for databases that are not well designed. So, if you see the need for ENUM, that means you need to re-think your data design. You mean like all those instances in the PostgreSQL system catalogs where character(1) has