create table screen_types (
id serial primary key,
name text
);
insert into screen_types (name) values ('regular'), ('stereo');
create table halls (
id serial primary key,
name text,
seets_count int,
screen_type int references screen_types(id)
);
insert into halls (name, seets_count, screen_type) values ('Blue', 25, 'regular');
-- ALTER TABLE table_name DROP CONSTRAINT IF EXISTS
(
SELECT constraint_name FROM information_schema.constraint_column_usage WHERE table_name='halls'
AND column_name='screen_type');
alter table halls drop constraint halls_screen_type_check ;
alter table halls add constraint halls_screen_type_check check (screen_type in ('regular', 'stereo', '3d'));
insert into halls (name, seets_count, screen_type) values ('Gold', 15, '3d');
select * from halls;