Re: how to know this row has been referenced or not???? - Mailing list pgsql-novice

From
Subject Re: how to know this row has been referenced or not????
Date
Msg-id 20050210202134.60241.qmail@web52408.mail.yahoo.com
Whole thread Raw
In response to how to know this row has been referenced or not????  (Akbar <tuxer@myrealbox.com>)
List pgsql-novice
--- Akbar <tuxer@myrealbox.com> wrote:

> Assume I have one table:
> id    name    comment
> 1     stupid  blabla
> 2     idiot   blabla
>
> These row has been referenced by other table.....
> Then I add one row to
> that table, so the table become:
> id    name    comment
> 1     stupid  blabla
> 2     idiot   blabla
> 3     dumb    bleble
>
> The row with id "3" has not been referenced by other
> table because I
> have just insert it ( it is still fresh ).... How do
> I know for sure
> that "this row" or "that row" has or has not been
> referenced by other
> table???? Of cource I can test it by trying to
> delete it.... if it has
> been referenced, the delete command will fail, and
> if it has not been
> referenced the delete command will success.....
>
> Thank you.
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>

akbar, run a query that pulls both the data you listed
and the referenced data.  if it shows up, it is
referenced, if it does not, it isn't referenced.

you could set up a query to only display the
information in the table you listed where there is no
referenced data.

i'm just getting into the sql part of this business,
so the experts would have to verify this, but i think
you you could query your listed table and list those
listed rows where the referenced data is null.

you would then get a list of all your rows where the
referenced data doesn't exist, which is what you want,
right?

you could do this in your application or you could use
pgadmin3, depending on your purpose for gathering this information.



__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

pgsql-novice by date:

Previous
From: "Van Ingen, Lane"
Date:
Subject: Using PL/pgSQL to Properly Define A Trigger
Next
From: "Sal Dkj"
Date:
Subject: Converting interval to numeric?