Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id F34752E002E for ; Tue, 10 Jun 2008 22:05:23 -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 59448-02-4 for ; Tue, 10 Jun 2008 22:05:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mailrelay.embarq.synacor.com (mailrelay.embarq.synacor.com [208.47.184.3]) by developer.postgresql.org (Postfix) with ESMTP id 3B9002E0065 for ; Tue, 10 Jun 2008 22:05:06 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha1; d=embarqmail.com; s=s012408; c=relaxed/simple; q=dns/txt; i=@embarqmail.com; t=1213146303; h=From:Subject:Date:To:Mime-Version:Content-Type; bh=HHQ9BXCn/cShSTuGdSeNsPprDxk=; b=dVgvhSDA7HHYu01kfYtKl6/w9thdgk7YEDbC2yd2qCIeJ6Kny36kS1uh+wYRBPl8 rY6C9b1oq4/68ZLdyTt7uWlTLbUFEd0bw9qJJQnFs1bvO5OyfWyrz/2vNTLLWUDq; X_CMAE_Category: 0,0 Undefined,Undefined X-CNFS-Analysis: v=1.0 c=1 a=yojgaC0HzEAA:10 a=gra_WR_tcWEA:10 a=whzS1hqWKy4Re_cPvtcA:9 a=LXqS6wMEZD07iUviWMEC9efUVQ4A:4 a=cvn8laQl214A:10 a=XF7b4UCPwd8A:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine Authentication-Results: smtp09.embarq.synacor.com smtp.user=amsden_linux@embarqmail.com; auth=pass (LOGIN) Received: from [71.2.202.190] ([71.2.202.190:45177] helo=[192.168.0.30]) by mailrelay.embarq.synacor.com (envelope-from ) (ecelerity 2.2.1.28 r(22594)) with ESMTPA id 70/5C-08696-FB42F484; Tue, 10 Jun 2008 21:05:03 -0400 Subject: Re: pqlib large object error From: Edward Amsden To: pgsql-interfaces@postgresql.org In-Reply-To: <26209.1213139125@sss.pgh.pa.us> 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> Content-Type: text/plain Date: Tue, 10 Jun 2008 21:04:51 -0400 Message-Id: <1213146291.19203.4.camel@dad-desktop2> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/10 X-Sequence-Number: 6753 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. :-| If you could explain I'd appreciate it :-) BTW once I get this working I'm going to write a PostgreSQL Large Object tutorial on my blog, so others don't have to struggle with the code like I am :-) On Tue, 2008-06-10 at 19:05 -0400, Tom Lane wrote: > Edward Amsden writes: > > On Tue, 2008-06-10 at 16:49 -0400, Tom Lane wrote: > >> Hmph. The only thing I can think of is that that index is corrupt, > >> but it seems unlikely that it would be so in all databases. What > >> happens if you REINDEX pg_largeobject? > > > The error has disappeared. > > Hmm, so something did happen to your index. > > > Now it can't write to the object. lo_open > > seems to be successful, but lo_write is failing with: > >> ERROR: invalid large-object descriptor: 0 > > You forgot to put the open-and-use-descriptor sequence inside a > BEGIN block. > > regards, tom lane