PostgreSQL supports ENUM from 8.3 onwards. For older versions, you can use :
You can simulate an ENUM by doing something like this :
CREATE TABLE persons (
person_id int not null primary key,
favourite_colour varchar(255) NOT NULL,
CHECK (favourite_colour IN ('red', 'blue', 'yellow', 'purple'))
);
You could also have :
CREATE TABLE colours (
colour_id int not null primary key,
colour varchar(255) not null
)
CREATE TABLE persons (
person_id int not null primary key,
favourite_colour_id integer NOT NULL references colours(colour_id),
);
which would have you add a join when you get to know the favorite colour, but has the advantage that you can add colours simply by adding an entry to the colour table, and not that you would not need to change the schema each time. You also could add attribute to the colour, like the HTML code, or the RVB values.
You also could create your own type which does an enum, but I don't think it would be any more faster than the varchar and the CHECK
.