Re: enumerated type..
От | Michael Kleiser |
---|---|
Тема | Re: enumerated type.. |
Дата | |
Msg-id | 40FBDEB0.2020405@webde-ag.de обсуждение исходный текст |
Ответ на | enumerated type.. ("raptor@tvskat.net" <raptor@tvskat.net>) |
Ответы |
Re: enumerated type..
|
Список | pgsql-general |
I don`t know, if there is a special feature in postgresql for this. The standard SQL-way is to create a lookup-table and define a foreign-key to it. create table states( state_id int primary key not null , state_text varchar(30) not null , constraint uk_states_state_text unique( state_text ) ); create table states( state_id int primary key not null , state_text varchar(30) not null ); alter table states add constraint uk_states_state_text unique( state_text ); create table your_table ( ... state_id int not null , constraint fk_yt_state_id foreign key (state_id) references states ); raptor@tvskat.net schrieb: > hi, > > Is it possible in Postgre to have enum type, so that later table fileld get values from 1-6 (saving space) > > 1 - statex > 2 - stateY > 3 - stateZ > > something like that and then constrain on this enum type.. > > tia > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
В списке pgsql-general по дате отправления: