foreign key question

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема foreign key question
Дата
Msg-id 201101050953.43830.gary.stainburn@ringways.co.uk
обсуждение исходный текст
Ответы Re: foreign key question  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
Hi folks,

I have a table which lists facilities and another table that lists access 
levels for those facilities. All straight forward using a foreign key set up 
using a normal references clause.

users=# select f_id, f_desc from facilities order by f_id;f_id |       f_desc

                                                    
 
------+---------------------

1| Login
                                                                                                                  3 |
Users
                                                                                                           
 
....   16 | Itinerary
....
31 rows)

users=# select * from facility_levels ;fl_f_id | fl_level |        fl_desc        
---------+----------+-----------------------     16 |        1 | Own itinerary     16 |        2 | Dealer/Dept
itinerary    16 |        3 | Dept itinerary     16 |        4 | Dealer/Dept On/Off     16 |        5 | Dept On/Off
16|        6 | All On/Off     16 |        7 | All features
 
(7 rows)

users=# 

Now I want to set up a new access level table specific to the itinerary, along 
the lines of

u_id int4 not null references users(u_id)
fl_level int4 not null references facility_levels(16, fl_level)

Firstly, is this possible, and secondly how would I do it?
-- 
Gary Stainburn
I.T. Manager
Ringways Garages
http://www.ringways.co.uk 


В списке pgsql-sql по дате отправления:

Предыдущее
От: bricklen
Дата:
Сообщение: Re: " in transaction" can't be killed with pg_cancel_backend(). Is it a bug?
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: foreign key question