Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 3D1372E0033 for ; Tue, 10 Jun 2008 22:25:15 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93653-04 for ; Tue, 10 Jun 2008 22:24:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id AEE062E0032 for ; Tue, 10 Jun 2008 22:24:54 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m5B1Oq9c027740; Tue, 10 Jun 2008 21:24:52 -0400 (EDT) To: Edward Amsden cc: pgsql-interfaces@postgresql.org Subject: Re: pqlib large object error In-reply-to: <1213146291.19203.4.camel@dad-desktop2> References: <1213118594.9123.11.camel@dad-desktop2> <21991.1213122593@sss.pgh.pa.us> <1213130242.15557.3.camel@dad-desktop2> <24396.1213130996@sss.pgh.pa.us> <1213134089.15557.22.camel@dad-desktop2> <26209.1213139125@sss.pgh.pa.us> <1213146291.19203.4.camel@dad-desktop2> Comments: In-reply-to Edward Amsden message dated "Tue, 10 Jun 2008 21:04:51 -0400" Date: Tue, 10 Jun 2008 21:24:52 -0400 Message-ID: <27739.1213147492@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/11 X-Sequence-Number: 6754 Edward Amsden 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. 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? regards, tom lane