Re: [QUESTIONS] Re: [HACKERS] text should be a blob field

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [QUESTIONS] Re: [HACKERS] text should be a blob field
Дата
Msg-id m0yAHDO-000BFRC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Re: [QUESTIONS] Re: [HACKERS] text should be a blob field  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [QUESTIONS] Re: [HACKERS] text should be a blob field  (Peter T Mount <psqlhack@maidast.demon.co.uk>)
Список pgsql-hackers
Bruce wrote:

> > 1. Is there a call made by the backend to each datatype when a row is
> >    deleted? I can't see one.
>
> Well, you could have a RULE that deletes the large object at row
> deletion time.  However, if two rows point to the same large object, the
> first one deleting it would delete the large object for the other.  The
> only solution to this is to have a separate large object table, and use
> reference counts so only the last user of the object deletes it.

    I think triggers are more appropriate.

    On INSERT check that the large object referenced exists.

    On  UPDATE  if large object reference changes, check that new
    large object exists and  check  if  old  large  object  isn't
    referenced  any more in which case drop the old large object.

    On DELETE check if large object isn't referenced any more ...

    Yes - I like triggers :-)


Jan

--

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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Speedups
Следующее
От: "Jackson, DeJuan"
Дата:
Сообщение: The Downloads page.