pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sandis <sandisj@parks.lv>
To: pgsql-sql@postgresql.org
Subject: data integrity
Date: Tue, 15 Aug 2000 14:30:01 +0300
Message-ID: <15604.000815@parks.lv> (raw)

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





view thread (2+ messages)  latest in thread

Message-ID: <15604.000815@parks.lv>
Permalink:  ../15604.000815@parks.lv/
Also on:    postgresql.org/message-id/15604.000815@parks.lv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: sandisj@parks.lv
  Subject: Re: data integrity
  In-Reply-To: <15604.000815@parks.lv>
  References: <15604.000815@parks.lv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox