[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] CREATE TYPE in Postgres 7.3.4
From:       Oliver Elphick <olly () lfix ! co ! uk>
Date:       2003-11-30 21:01:01
[Download RAW message or body]

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 


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic