Re: losing my large objects with Postgresql 8.1.4 and 8.1.5

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eric Davies <Eric(at)barrodale(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: losing my large objects with Postgresql 8.1.4 and 8.1.5
Date: 2007-01-06 01:40:37
Message-ID: 24324.1168047637@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eric Davies <Eric(at)barrodale(dot)com> writes:
> Some of my custom server functions/data types that work correctly
> under Postgresql 8.0.1 are having trouble with lost large objects
> under Postgresql 8.1.4 and Postgresql 8.1.5, but only in particular
> usages.

> When I execute the following sequence of commands:
> select MyTypeToText( BuildMyType('asdf'));
> I get the following error
> ERROR: large object 33016 does not exist
> \lo_list (in psql) doesn't show any new large objects.

MyTypeToText is probably referencing a start-of-statement snapshot,
in which the LO doesn't exist yet. This is a consequence of making
read-only accesses to LOs be MVCC-compliant. Probably your best bet
for working around it is to open the LO in read/write mode, even if
you don't intend to write it --- that will make the behavior like 8.0.

Relevant 8.1 release note:

Read-only large object descriptors now obey MVCC snapshot semantics

When a large object is opened with INV_READ (and not INV_WRITE),
the data read from the descriptor will now reflect a "snapshot" of
the large object's state at the time of the transaction snapshot in
use by the query that called lo_open(). To obtain the old behavior
of always returning the latest committed data, include INV_WRITE in
the mode flags for lo_open().

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Best 2007-01-06 02:35:36 Re: Database Corruption - last chance recovery options?
Previous Message Jorge Godoy 2007-01-06 01:33:32 Re: Database versus filesystem for storing images