About referential integrity. - Mailing list pgsql-sql

From BOURIAUD
Subject About referential integrity.
Date
Msg-id 200202251503.g1PF3vn21366@necker.ac-rouen.fr
Whole thread Raw
Responses Re: About referential integrity.  ("Josh Berkus" <josh@agliodbs.com>)
Re: About referential integrity.  (Oliver Elphick <olly@lfix.co.uk>)
Re: About referential integrity.  (Peter Eisentraut <peter_e@gmx.net>)
Re: About referential integrity.  (David BOURIAUD <david.bouriaud@ac-rouen.fr>)
List pgsql-sql
Hi there !
I've just subscribed to this list because I found something quite annoying 
about postgres and SQL querries as well.
Indeed, as far as I know, postgreSQL is reffered as a SGBD-R, the 'R' meaning 
relational.

Anyway, I don't understand why when tables are built with this referential 
integrity the back-end doesn't fullfill any request posted on those tables.

Since I fear I'm not clear in the above, let me show you an example.


Let's say I create two tables as shown below :

create table t1
(key1 serial PRIMARY KEY,field1 varchar(30)
);

create table t2
(key2 serial not null PRIMARY KEY,key1 int4 references t1,field2 varchar(30)
); 

As far as I know, t2 and t1 are linked together. If I want to select rows 
that belong to both tables, I would have to write something like this :
select * from t1, t2 where t1.key1 = t2.key1;

I think this is quite redundant, since I've created my tables so as to make 
sure that they would respect what is in the select above !!!!


So, why souldn't I be abble to write :
select * from t1, t2;

and have the backend returns me only the rows that have t1.key1 = t2.key2 ???

If anyone have any clue about it, please let me know.

I know that this is not a postgreSQL bug, since there is NO SGBDR acting so 
(as far as I know anyway). But I'd like to know why such SGBD, said to be 
Relationnal don't do this by themselves.
Thanks for your clues and for having read me.
-- 
David BOURIAUD
----------------------------------------------------------
In a world without walls or fences, what use do we have 
for windows or gates ?
----------------------------------------------------------
ICQ#102562021



pgsql-sql by date:

Previous
From: Roberto Mello
Date:
Subject: Re: returning a record from a function?
Next
From: Roberto Mello
Date:
Subject: Re: PLPGSQL func. defn. for returning resultset?