pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Rod Taylor <pg@rbt.ca>
Cc: Martín Marqués <martin@bugs.unl.edu.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: ENUM like data type
Date: Wed, 29 Jun 2005 18:55:59 -0400
Message-ID: <29905.1120085759@sss.pgh.pa.us> (raw)
In-Reply-To: <200506292320.32726.peter_e@gmx.net>
References: <ED4E30DD9C43D5118DFB00508BBBA76EB167AF@neptun.sonorys.at>
	<200506291021.10986.martin@bugs.unl.edu.ar>
	<1120051729.39304.113.camel@home>
	<200506292320.32726.peter_e@gmx.net>

Peter Eisentraut <peter_e@gmx.net> 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, text concatenation operators and the like.  
> I suppose in practice this won't matter too much, but it can't be 
> called a clean design.  What you'd really need is a way to create a 
> distinct type.  SQL has a feature for that, but PostgreSQL hasn't 
> implemented it.

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.

			regards, tom lane



view thread (16+ messages)  latest in thread

Message-ID: <29905.1120085759@sss.pgh.pa.us>
Permalink:  ../29905.1120085759@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29905.1120085759@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter_e@gmx.net, pg@rbt.ca, martin@bugs.unl.edu.ar
  Subject: Re: ENUM like data type
  In-Reply-To: <29905.1120085759@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox