libpg: large object problems

From: Seth Nickell <snickell(at)stanford(dot)edu>
To: pgsql-novice(at)postgresql(dot)org
Subject: libpg: large object problems
Date: 2003-05-03 03:50:46
Message-ID: 1051933842.10718.14.camel@beauty.stanford.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I'm trying to figure out how to get large objects working using libpg.
The problem is that whenever I do an lo_open on an object, I get back
"-1" as the file descriptor (and of course, an lo_read on that fails).

Oid id = lo_creat (dbConn, INV_READ | INV_WRITE);
fd = lo_open (dbConn, id, INV_WRITE);

That's what I'm basically doing. "id" ends up being a somewhat sensible
looking large-ish number.

I've also tried doing lo_open's of files that I lo_import'ed (and can
successfully lo_export using the console, so I know they're "in there").
Same problem.

Any ideas what I'm doing wrong? I've included the full text of my simple
test case below. I've also tried this with a remote PostgreSQL server,
both times verifying that I could run queries and such (so the
connection to the server is working on at least that level :-)

thanks!

-Seth

---------Full Text of Test Program--------

static PGconn *dbConn = NULL;

int main(int argc, char **argv) {
char * error;
Oid id;
int fd;

dbConn = PQconnectdb("");
error = PQerrorMessage(dbConn);

if(strlen(error) > 0){
fprintf(stderr, "DB connection error to gargamel: %s\n", error);
return -1;
}

Oid id = lo_creat (dbConn, INV_READ | INV_WRITE);

fd = lo_open (dbConn, id, INV_WRITE);

printf ("fd is: %d, id is: %d\n", fd, id);

return 0;
}

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message greg 2003-05-03 14:00:46 Re: libpg: large object problems
Previous Message Tom Lane 2003-05-03 01:47:02 Re: Search speed issues