Re: CREATE TYPE in Postgres 7.3.4

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Alex Page <alex(dot)page(at)cancer(dot)org(dot)uk>
Cc: PostgreSQL general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: CREATE TYPE in Postgres 7.3.4
Date: 2003-11-30 21:01:01
Message-ID: 1070226061.7727.2563.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Satrapa 2003-11-30 22:38:06 Re: Was: Triggers, Stored Procedures, PHP
Previous Message Carlos Moreno 2003-11-30 19:56:26 Upgrading from 7.2.3 to....??