Re: lo function changed in PostgreSQL 8.1.1

Поиск
Список
Период
Сортировка
От Premsun Choltanwanich
Тема Re: lo function changed in PostgreSQL 8.1.1
Дата
Msg-id 439FFAD8.C5F7.004C.0@nsasia.co.th
обсуждение исходный текст
Ответ на Re: lo function changed in PostgreSQL 8.1.1  (Richard Huxton <dev@archonet.com>)
Ответы Re: lo function changed in PostgreSQL 8.1.1  (Richard Huxton <dev@archonet.com>)
Re: lo function changed in PostgreSQL 8.1.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Dear Richard,
 
I think I use contrib/lo type  for manage lo. What is wrong?
 
Now I have no idea for manage lo on PostgreSQL 8.1.1, I think I need a time to learn.
 
Could you give me suggestion?
 
Regards,
 
Premsun
 

>>> Richard Huxton <dev@archonet.com> 12/13/2005 19:22:01 >>>
Premsun Choltanwanich wrote:
> Dear All,

> I use '$libdir/lo' for manage my Large Object for PostgreSQL 8.0.4 . Now
> I try to up my PostgreSQL to new version as 8.1.1 but I think I got some
> error about lo (Large Object).

> lo (Large Object) function that normally shown in function list now
> disappear.  I'm sure that I already check on Large Object box  when I
> install. I found some information on
> http://www.postgresql.org/docs/8.1/interactive/lo-interfaces.html#AEN26978 about
> lo function. PostgreSQL has many new lo function that I never use in
> version 8.0.4 and some function I have use is not found (lo_in , lo_out).

I don't see any major difference between the functions listed for the
8.0 and 8.1 manuals. Are you sure you're not talking about the
contrib/lo type (see extract from the README.lo below)? If so, run the
installer again and check you have ticked the box.

HTH

Overview

One of the problems with the JDBC driver (and this affects the ODBC driver
also), is that the specification assumes that references to BLOBS (Binary
Large OBjectS) are stored within a table, and if that entry is changed, the
associated BLOB is deleted from the database.

As PostgreSQL stands, this doesn't occur.  Large objects are treated as
objects in their own right; a table entry can reference a large object by
OID, but there can be multiple table entries referencing the same large
object OID, so the system doesn't delete the large object just because you
change or remove one such entry.

Now this is fine for new PostgreSQL-specific applications, but existing ones
using JDBC or ODBC won't delete the objects, resulting in orphaning -
objects
that are not referenced by anything, and simply occupy disk space.


The Fix

I've fixed this by creating a new data type 'lo', some support
functions, and
a Trigger which handles the orphaning problem.  The trigger essentially just
does a 'lo_unlink' whenever you delete or modify a value referencing a large
object.  When you use this trigger, you are assuming that there is only one
database reference to any large object that is referenced in a
trigger-controlled column!

The 'lo' type was created because we needed to differentiate between plain
OIDs and Large Objects. Currently the JDBC driver handles this dilemma
easily,
but (after talking to Byron), the ODBC driver needed a unique type. They had
created an 'lo' type, but not the solution to orphaning.

You don't actually have to use the 'lo' type to use the trigger, but it
may be
convenient to use it to keep track of which columns in your database
represent
large objects that you are managing with the trigger.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Immodest Proposal: pg_catalog.pg_ddl
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: lo function changed in PostgreSQL 8.1.1