Received: from necker.ac-rouen.fr (smtp.ac-rouen.fr [194.167.110.3]) by postgresql.org (Postfix) with ESMTP id F1DA34761FC for ; Mon, 25 Feb 2002 10:02:30 -0500 (EST) Received: from there (localhost.localdomain [127.0.0.1]) by necker.ac-rouen.fr (8.11.0/8.11.0) with SMTP id g1PF3vn21366 for ; Mon, 25 Feb 2002 16:03:57 +0100 Message-Id: <200202251503.g1PF3vn21366@necker.ac-rouen.fr> Content-Type: text/plain; charset="iso-8859-1" From: BOURIAUD Organization: Inspection =?iso-8859-1?q?acad=E9mique=20de?= l'Eure To: pgsql-sql@postgresql.org Subject: About referential integrity. Date: Mon, 25 Feb 2002 16:01:49 +0100 X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archive-Number: 200202/356 X-Sequence-Number: 6778 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