From: | BOURIAUD <david(dot)bouriaud(at)ac-rouen(dot)fr> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | About referential integrity. |
Date: | 2002-02-25 15:01:49 |
Message-ID: | 200202251503.g1PF3vn21366@necker.ac-rouen.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | panjas51 | 2002-02-25 16:16:06 | [CHALLANGE] Add seconds to a date |
Previous Message | Roberto Mello | 2002-02-25 14:59:57 | Re: returning a record from a function? |