Re: Enum in PostgreSQL - How to

From: "Dan Langille" <dan(at)langille(dot)org>
To: Jürgen Hauser <hauser(at)pandora(dot)be>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Enum in PostgreSQL - How to
Date: 2003-04-07 13:11:40
Message-ID: 3E9140CC.28493.A1E2EFB@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7 Apr 2003 at 15:04, Jürgen Hauser wrote:

> Hi,
>
> thanks for your reply. However, the mentioned method doesm't seem to work.
>
> I also tried something like
>
> CREATE TABLE accounts
> (
> accountid SERIAL,
> PRIMARY KEY (accountid),
> ....
> accountType CHECK ( accountType = 'default' OR accountType = 'custom')
> NOT NULL);
>
> But this doesn't work either....

Please CC all posts to the mailing list.

Explaining what "doesn't work" helps, but I think I see the problem.
The example shown in the URL provided is incomplete. But looking up
that CHECK option will show the correct syntax. Please see
http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=sql-
createtable.html and look in the Examples section:

name VARCHAR(40) NOT NULL CHECK (name <> '')

You need a variable time, in your case, I suggest TEXT.
--
Dan Langille : http://www.langille.org/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Manfred Koizar 2003-04-07 13:29:17 Re: unable to dump database, toast errors
Previous Message Dan Langille 2003-04-07 12:51:32 Re: possible time change issue - known problem?