dbTalk Databases Forums  

Why is a REFERENCES privilege required? And is it "better" to createFK relationship only between tables in the same schema?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Why is a REFERENCES privilege required? And is it "better" to createFK relationship only between tables in the same schema? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dana
 
Posts: n/a

Default Why is a REFERENCES privilege required? And is it "better" to createFK relationship only between tables in the same schema? - 07-14-2009 , 06:37 AM






Not too long ago, I needed to create a FK relationship from a table in
my schema to a table in another schema on the same database instance.
I learned that I needed to be granted the REFERENCES privilege on the
"remote" table.

Why are things set-up this way? And is it ill-advised to be creating
FK relationships to tables in "remote" schemas? If so, why? Should FK
relationships only be established between tables in the same schema.

I don't have an agenda here other than trying to learn some Best
Practices in this regard. And I'm curious about why things are as they
are regarding the pre-condition of a REFERENCES grant.

Thanks.

Dana

Reply With Quote
  #2  
Old   
Carl Kayser
 
Posts: n/a

Default Re: Why is a REFERENCES privilege required? And is it "better" to create FK relationship only between tables in the same schema? - 07-14-2009 , 06:53 AM






"dana" <dana_at_work (AT) yahoo (DOT) com> wrote

Quote:
Not too long ago, I needed to create a FK relationship from a table in
my schema to a table in another schema on the same database instance.
I learned that I needed to be granted the REFERENCES privilege on the
"remote" table.

Why are things set-up this way? And is it ill-advised to be creating
FK relationships to tables in "remote" schemas? If so, why? Should FK
relationships only be established between tables in the same schema.

I'm not an Oracle guy but REFERENCES is ANSI defined. My take is that it
allows you to put rows in your table that is validated against another table
for which you may not be granted SELECT. So (it seems to me that) this is
an unusual security/validation feature for RDBMSs. If your table is
supposed to have a (key-wise) subset of another table and the key
information is "sensitive" in the "parent table" then this feature supports
the situation.

Quote:
I don't have an agenda here other than trying to learn some Best
Practices in this regard. And I'm curious about why things are as they
are regarding the pre-condition of a REFERENCES grant.

Thanks.

Dana

Reply With Quote
  #3  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Why is a REFERENCES privilege required? And is it "better" tocreate FK relationship only between tables in the same schema? - 07-14-2009 , 08:16 AM



On Jul 14, 7:53*am, "Carl Kayser" <kayse... (AT) bls (DOT) gov> wrote:
Quote:
"dana" <dana_at_w... (AT) yahoo (DOT) com> wrote in message

news:70e3a29a-7575-41c0-b3ad-0e1dd70eeff8 (AT) r25g2000vbn (DOT) googlegroups.com...

Not too long ago, I needed to create a FK relationship from a table in
my schema to a table in another schema on the same database instance.
I learned that I needed to be granted the REFERENCES privilege on the
"remote" table.

Why are things set-up this way? And is it ill-advised to be creating
FK relationships to tables in "remote" schemas? If so, why? Should FK
relationships only be established between tables in the same schema.

I'm not an Oracle guy but REFERENCES is ANSI defined. *My take is that it
allows you to put rows in your table that is validated against another table
for which you may not be granted SELECT. *So (it seems to me that) thisis
an unusual security/validation feature for RDBMSs. *If your table is
supposed to have a (key-wise) subset of another table and the key
information is "sensitive" in the "parent table" then this feature supports
the situation.



I don't have an agenda here other than trying to learn some Best
Practices in this regard. And I'm curious about why things are as they
are regarding the pre-condition of a REFERENCES grant.

Thanks.

Dana- Hide quoted text -

- Show quoted text -
When the object owner, userA, grants userB, REFERENCES, userA has in
effect given userB the right to stop userA from updating their own
table unless userA's action meets the requirement imposed by userB's
FK.

In a large application where multiple owners are definded for areas/
departments you would expect that the need for FK to reference other
owners tables will exist.

HTH -- Mark D Powell --

Reply With Quote
  #4  
Old   
dana
 
Posts: n/a

Default Re: Why is a REFERENCES privilege required? And is it "better" tocreate FK relationship only between tables in the same schema? - 07-16-2009 , 06:52 AM



Thanks Carl and Mark.

Mark, you wrote:
Quote:
When the object owner, userA, grants userB, REFERENCES, userA has in
effect given userB the right to stop userA from updating their own
table unless userA's action meets the requirement imposed by
userB's FK.
Thanks Mark. Wouldn't it be "more correct" or more complete to add to
the above (although it could be deduced):

.... if and only if userB then proceeds to create a foreign key
referencing userA's table? UserA granting REFERENCES to userB doesn't
auto-generate a FK in userB's schema from userB's table to userA's
table. It's just a pre-condition for userA electing to do generate
that key, and volunteering, as it were, to be so constrained. Unless
I've misunderstood you--quite possible. As the OP, I'm the confused
one here by definition. :-)

Just wanted to make things as clear as possible for myself and for
posterity.

Quote:
In a large application where multiple owners are definded for areas/ departments you would expect that the need for FK
to reference other owners tables will exist.
Makes sense. But are there any "gotchas" you know of in doing so? I
guess the biggest "anti-gotcha" would be getting in trouble by
duplicating Parent tables from other tables to avoid having to request
a REFERENCES grant from the schema owner. The whole point, after all,
with databases (at least a significant one) is to reduce or eliminate
data duplication (except for controlled redundancy for a good, well-
understood, specific purpose).

Carl, you wrote:

Quote:
If your table is supposed to have a (key-wise) subset of another table and the key information is "sensitive" in
the "parent table" then this feature supports the situation.
This makes sense to me too. Unless there's a subtlety I've missed--
again, quite possible.

Thanks again guys. I appreciate the replies.

Dana

Reply With Quote
  #5  
Old   
dana
 
Posts: n/a

Default Re: Why is a REFERENCES privilege required? And is it "better" tocreate FK relationship only between tables in the same schema? - 07-20-2009 , 08:18 AM



Any additional thoughts on this?

Thanks.

Reply With Quote
  #6  
Old   
dana
 
Posts: n/a

Default Re: Why is a REFERENCES privilege required? And is it "better" tocreate FK relationship only between tables in the same schema? - 07-21-2009 , 04:24 AM



Going once, going twice. :-) Trying to get complete closure on this
one for myself--so I don't have to think about it any further.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.