Skip site navigation (1) Skip section navigation (2)

Re: [SQL] Finding missing records...

From: wieck(at)debis(dot)com (Jan Wieck)
To: Matthew Hagerty <matthew(at)venux(dot)net>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Finding missing records...
Date: 2000-02-25 16:11:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
> Greetings,
> I have two tables that maintain a 1:1 relationship via an int based primary
> key.  A record in the primary table should never exist without an
> associated record in the secondary table, however somehow this has
> happened.  Can someone demonstrate a query that would show all records in
> the primary table that do not have associated records in the secondary table?

        (SELECT att_fk FROM tab_fk WHERE att_fk = att_pk);

    This is the SQL3 referential definition of PENDANT. It'll not
    be in the FOREIGN KEY support of 7.0, but we'll discuss if we
    implement  it  for 7.1 (even if it will be damned slooooow if
    done on every delete/update to an FK table).



# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

In response to

pgsql-sql by date

Next:From: Tom LaneDate: 2000-02-25 16:29:16
Subject: Re: [SQL] how to create index on timestamp field in pre v7 database
Previous:From: Matthew HagertyDate: 2000-02-25 15:56:18
Subject: Finding missing records...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group