Re: pqlib large object error

From: Edward Amsden <amsden_linux(at)embarqmail(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: pqlib large object error
Date: 2008-06-11 02:14:14
Message-ID: 1213150454.19203.17.camel@dad-desktop2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Tue, 2008-06-10 at 21:24 -0400, Tom Lane wrote:
> Edward Amsden <amsden_linux(at)embarqmail(dot)com> writes:
> > Thanks for all your help. I'm somewhat amateur with C and even less
> > experienced with PostgreSQL (I'm a recent MySQL convert). Even after
> > some googling, I have no idea what this BEGIN block is. Is it C or is it
> > SQL? That probably makes me a n00b. :-|
>
> You need a SQL "BEGIN" (or "START TRANSACTION") command and a SQL
> "COMMIT" (or "END") command around anything that involves having a
> large object descriptor open. It might help to look at the sample
> program here:
>
> http://www.postgresql.org/docs/8.3/static/lo-examplesect.html
>
> It's not amazingly well commented :-(, but the lines
>
> res = PQexec(conn, "begin");
> res = PQexec(conn, "end");
>
> are *not* optional.
Thanks for your help with this. I successfully wrote about 7MB in and
read it back out :-)
>
> Meanwhile, I'm still wondering what happened to your pg_largeobject
> index. You said you saw the problem in multiple databases, which
> suggests that the index was broken in template1 and then the damage
> was propagated to other databases by CREATE DATABASE. Can you still
> see a problem if you make your program connect to some other database?
There is no issue with other databases. I created another database, and
had no issues.

It is my understanding that it shouldn't be database-dependent, since
the only part of large objects that is stored outside of the postgres
database is references to the large object OIDs.

Again, thanks for your help. Let me know if I should check on anything
else regarding the index corruption.

Also, I will post a link to the tutorial in my blog as a reply to this
thread as soon as the blog post is up.

Edward

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-11 11:47:04 Re: pqlib large object error
Previous Message Tom Lane 2008-06-11 01:24:52 Re: pqlib large object error