Re: how to know this row has been referenced or not????

Поиск
Список
Период
Сортировка
От
Тема Re: how to know this row has been referenced or not????
Дата
Msg-id 20050210202134.60241.qmail@web52408.mail.yahoo.com
обсуждение исходный текст
Ответ на how to know this row has been referenced or not????  (Akbar <tuxer@myrealbox.com>)
Список 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 по дате отправления:

Предыдущее
От: "Van Ingen, Lane"
Дата:
Сообщение: Using PL/pgSQL to Properly Define A Trigger
Следующее
От: "Sal Dkj"
Дата:
Сообщение: Converting interval to numeric?