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
);




[EMAIL PROTECTED] 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 [EMAIL PROTECTED])


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to