From: | <operationsengineer1(at)yahoo(dot)com> |
---|---|
To: | Akbar <tuxer(at)myrealbox(dot)com>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: how to know this row has been referenced or not???? |
Date: | 2005-02-10 20:21:33 |
Message-ID: | 20050210202134.60241.qmail@web52408.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
--- Akbar <tuxer(at)myrealbox(dot)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(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Sal Dkj | 2005-02-11 01:48:06 | Converting interval to numeric? |
Previous Message | Van Ingen, Lane | 2005-02-10 19:50:13 | Using PL/pgSQL to Properly Define A Trigger |