Re: disabling foreign keys

From: Clay Colburn <clay.colburn_at_gmail.com>
Date: Fri, 25 Mar 2011 10:17:55 -0700
Message-ID: <AANLkTimEs8tbsUCZfmUC4OVyQZuEDUO5uAvfdV9UqGVi_at_mail.gmail.com>



When trying to use "rely disable novalidate" I get the following error:

SQL Error: ORA-25158: Cannot specify RELY for foreign key if the associated primary key is NORELY

I looked at the table that contains the primary key and found that the RELY flag was not set (null). After setting the rely flag on the primary key, I successfully created the foreign key constraint with rely enabled.

The only documentation that I've been able to find talks about this flag allowing oracle to increase query rewrite performance by assuming that data is referentially correct (http://tinyurl.com/6z3v9h8). By this logic, why does it matter if you set it on the primary key? What are you trying to assert about valid data by setting on the primary key? Wouldn't the assertion about validity only come in when linking a foreign key to the primary key?

Hopefully I'm just missing something obvious here :)

Thanks everyone!

On Thu, Feb 17, 2011 at 9:28 AM, Greg Rahn <greg_at_structureddata.org> wrote:

> Generally I think most who desire this behavior use "rely disable
> novalidate" for their FKs.
>
> http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/constra.htm#i1006284
>
> On Thu, Feb 17, 2011 at 12:28 AM, Timur Akhmadeev
> <Akhmadeev_at_netcracker.com> wrote:
> > But you can make CBO to rely on the constraint even if it is disabled:
>
> --
> Regards,
> Greg Rahn
> http://structureddata.org
>

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 25 2011 - 12:17:55 CDT

Original text of this message