Re: CREATE TYPE in Postgres 7.3.4 - Mailing list pgsql-general

From Oliver Elphick
Subject Re: CREATE TYPE in Postgres 7.3.4
Date
Msg-id 1070226061.7727.2563.camel@linda.lfix.co.uk
Whole thread Raw
In response to CREATE TYPE in Postgres 7.3.4  (Alex Page <alex.page@cancer.org.uk>)
Responses Re: CREATE TYPE in Postgres 7.3.4
List pgsql-general
On Thu, 2003-11-27 at 12:43, Alex Page wrote:
> This is probably really basic, but I can't seem to get it to work. I'm
> trying to create an enumerated type, using the following code:
>
>   CREATE FUNCTION enum_gender_in (cstring) RETURNS enum_gender IMMUTABLE AS
...

Why not just use a CHECK constraint?

    CREATE TABLE xxx (
      ...
      gender   CHAR(1)   CONSTRAINT "valid gender"
                           CHECK (gender IN ('M', 'F')),
      ...
    );
--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "But grow in grace, and in the knowledge of our Lord
      and Saviour Jesus Christ. To him be glory both now and
      for ever. Amen."           II Peter 3:18


pgsql-general by date:

Previous
From: Carlos Moreno
Date:
Subject: Upgrading from 7.2.3 to....??
Next
From: Rick Morris
Date:
Subject: Re: PostgreSQL Advocacy, Thoughts and Comments