Another constant in foreign key problem.

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема Another constant in foreign key problem.
Дата
Msg-id 201202221035.11963.gary.stainburn@ringways.co.uk
обсуждение исходный текст
Ответы Re: Another constant in foreign key problem.  (Philip Couling <phil@pedal.me.uk>)
Список pgsql-sql
I have three tables,

users - all users of my web site
facilities - facilities available on my web site
facility_levels - access levels per user/facility.

One of my facilities is a document library (f_id = 22)
For this facility I have the levels

select * from facility_levels where fl_f_id=22 order by fl_level;
fl_f_id | fl_level |   fl_desc    
---------+----------+--------------     22 |        1 | Read Only     22 |        2 | Add Versions     22 |        3 |
Amend
(3 rows)


This sets the global access level for the Document Library per user.

I now want to add authentication control on a document or folder level. For 
this I need to create a table library_document_user_level

u_id - user id
ld_id - library document id
fl_level - level

The foreign key constraint on fl_level needs to check facility_levels for
fl_f_id = 22 as well as fl_level existing.

I've googled this but can't find a suitable solution. Can anyone help please.
-- 
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk 


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

Предыдущее
От: Marcin Krawczyk
Дата:
Сообщение: Re: Function definitions - batch update
Следующее
От: "Oliveiros d'Azevedo Cristina"
Дата:
Сообщение: Re: Another constant in foreign key problem.