Received: from webmail.parks.lv (mail@smtp.parks.lv [195.2.96.248]) by hub.org (8.10.1/8.10.1) with ESMTP id e7FCTBn19777 for ; Tue, 15 Aug 2000 08:29:11 -0400 (EDT) Received: from SANDIS ([195.2.123.209]) by webmail.parks.lv (8.9.3/8.9.3) with ESMTP id OAA30134 for ; Tue, 15 Aug 2000 14:29:09 +0200 Date: Tue, 15 Aug 2000 14:30:01 +0300 From: Sandis X-Mailer: The Bat! (v1.41) X-Priority: 3 (Normal) Message-ID: <15604.000815@parks.lv> To: pgsql-sql@postgresql.org Subject: data integrity Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200008/106 Hello pgsql-sql, sorry for my question that is obviously a kind of lame and not related directly to postges, but i never dealt with it before & need an idea what to do right now. there is a db with a few tables that have related (joined) fields. if record in a one table (auxiliary) gets deleted (along with it's primary key), reference to it in another table (main) points to nowhere. then doing a complex query with a join on that tables doesn't return such corrupted rows that contains references to deleted rows in other tables. what's the solution? should i check if this 'project', for example, have 'contacts' associated with it, and do not allow user to delete it, than show that 'contacts' list and ask if she wants delete all of them? or may be dont show a list, but just warn that there is $number 'contacts' related to this 'project', do you want to delete them all? how about joins in delete query? DELETE FROM projects, contacts WHERE projects.contact = contacts.id AND projects.id = '$id'; he, i wrote the answer myself. may be dont send it at all? can someone suggest some good online resource where such common sql topics discussed? thanks --:)-- Best regards, Sandis mailto:sandisj@parks.lv