Thread: Referential integrity: broken rule?

Referential integrity: broken rule?

From
"Franz J Fortuny"
Date:
This table:

create table things
( idthing integer not null, isthis boolean not null primary key(idthing,isthis)
....

)

would be referenced by this one:

create table forthings
( fromthing integer not null references things(idthing),

....

)

The above SHOULD NOT be accepted, since table "things" did not declare
idthing as UNIQUE. However, it IS accepted under PostgreSQL (7.0.2).

Am I wrong?

Best regards,

F J Fortuny




Re: Referential integrity: broken rule?

From
Stephan Szabo
Date:
Yes, I believe it is mentioned in the docs (well at least the
sgml source, I don't have a compiled doc set) as a bug
of the implementation somewhere in the section on references.  
7.1 should fail for this case, although it doesn't properly deal with
dropping the unique constraint later.

Stephan Szabo
sszabo@bigpanda.com

On Wed, 11 Oct 2000, Franz J Fortuny wrote:

> This table:
> 
> create table things
> (
>   idthing integer not null,
>   isthis boolean not null
>   primary key(idthing,isthis)
> ....
> 
> )
> 
> would be referenced by this one:
> 
> create table forthings
> (
>   fromthing integer not null references things(idthing),
> 
> ....
> 
> )
> 
> The above SHOULD NOT be accepted, since table "things" did not declare
> idthing as UNIQUE. However, it IS accepted under PostgreSQL (7.0.2).