Re: [BUG] calling lo_creat()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Barnes, Sandy (Sandra)" <Sandy(dot)Barnes(at)Honeywell(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUG] calling lo_creat()
Date: 2000-08-30 19:31:46
Message-ID: 20638.967663906@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

"Barnes, Sandy (Sandra)" <Sandy(dot)Barnes(at)Honeywell(dot)com> writes:
> Platform: PostgreSQL 7.0.2 on RedHat6.2 Linux
> Test: Testing the creation of large objects. I was putting the large
> objects into a database table but this
> test program recreates the error for me without having to do that.
> Program Error: Can't create large object
> Database Log Error: FATAL 1: my bits moved right off the end of the world!
> Recreate index pg_attribute_relid_attnum_index

Can anyone else duplicate this? I don't see it on my available boxes
(7.0.2 and current on HPUX and an old Linux box). The test program
is pretty trivial, see attached.

regards, tom lane

/*-------------------------------------------------------------------------
*
* loOid2.c
* test creation of many large objects
*-------------------------------------------------------------------------
*/
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "libpq-fe.h"
#include "libpq/libpq-fs.h"

static Oid
createOid(PGconn *conn, int i)
{
Oid lobjId;
int lobj_fd;

/*
* create a large object
*/
lobjId = lo_creat(conn, INV_READ | INV_WRITE);
if (lobjId == 0)
{
fprintf(stderr, "can't create large object\n");
exit(1);
}

lobj_fd = lo_open(conn, lobjId, INV_WRITE);

printf("oid [%d] %d\n", lobjId, i);
/* printf("\tfd [%d]", lobj_fd); */

lo_close(conn, lobj_fd);

return lobjId;
}

static void
exit_nicely(PGconn *conn)
{
PQfinish(conn);
exit(1);
}

int
main(int argc, char **argv)
{
char *database;
Oid lobjOid;
PGconn *conn;
PGresult *res;
int i;

database = argv[1];

/*
* set up the connection
*/
conn = PQsetdb(NULL, NULL, NULL, NULL, database);

/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
{
fprintf(stderr, "Connection to database '%s' failed.\n", database);
fprintf(stderr, "%s", PQerrorMessage(conn));
exit_nicely(conn);
}

res = PQexec(conn, "begin");
PQclear(res);
for (i=0; i<100; i++)
{
lobjOid = createOid(conn, i);
}
res = PQexec(conn, "end");
PQclear(res);
PQfinish(conn);
return 0;
}

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2000-08-30 21:13:39 Page 13 of tutorial has a typo I believe
Previous Message Tom Lane 2000-08-30 14:40:19 Re: inconsistent debug log output

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-08-30 20:28:12 Re: Backend-internal SPI operations
Previous Message Mark Hollomon 2000-08-30 19:24:57 Re: Backend-internal SPI operations