Problem with security and cross-schema foreign keys [message #243684] |
Fri, 08 June 2007 07:01 |
rmkrueger
Messages: 2 Registered: June 2007
|
Junior Member |
|
|
Hi,
I'm stuck with the following problem. Suppose I wanted to execute an SQL-Script that creates two tables in different schemas with foreign keys referencing each other like
create table TEST1.TABLE1 (
PK INTEGER PRIMARY KEY,
FK INTEGER
);
create table TEST2.TABLE2 (
PK INTEGER PRIMARY KEY,
FK INTEGER
);
alter table TEST1.TABLE1 add constraint FK1 foreign key(fk) references TEST2.TABLE2;
alter table TEST2.TABLE2 add constraint FK2 foreign key(fk) references TEST1.TABLE1;
Now, is there any combination of privileges that would allow a user to execute that sequence of statements successfully? Right now my understanding is that there is no such thing as a REFERENCE ANY TABLE privilege and therefore this is not possible. Is this correct or am I missing something?
The only way I can see is to add the respective object privileges (REFERENCES) after the tables have been created, which would alter the script, which is what I want to avoid.
Thanks in advance,
Robert
|
|
|
|
|