postgesql-7.3.3 lo_create/lo_open fails - Mailing list pgsql-general

From Colm Dobbs
Subject postgesql-7.3.3 lo_create/lo_open fails
Date
Msg-id 3F33DDF1.7080508@aepona.com
Whole thread Raw
Responses Re: postgesql-7.3.3 lo_create/lo_open fails
List pgsql-general
Hi Guys,

I'm currenlty involved in a port of our gateway code from a Solaris 8
environment to a HP-UX11.11 incorporating postgresql-7.3.3. We're having
some problems with creation and opening of large objects and was hoping
that you may be able to shed some light on them.

I extracted the LO code into the test program as below and am able to
recreate the problems:

int
main(
    int argc,
    char * argv[]
)
{
    char chBytes[] = "FILLER";
    int iLength = strlen(chBytes);

     char * chTempDB = NULL;
     chTempDB = getenv ("CMN_DBNAME");
     char *chTempUserName=NULL;
     chTempUserName = getenv ("CMN_DBUSERNAME");

    PGconn * conn = PQsetdbLogin(NULL, NULL, NULL, NULL, chTempDB,
chTempUserName, NULL);

    /*
     * check to see that the backend connection was successfully made
     */
    if (PQstatus(conn) == CONNECTION_BAD)
    {
        cout << "Large object connection is bad " << endl;
    }

    PGresult   *    res = PQexec(conn, "begin");
    PQclear(res);

    Oid lobjId = lo_creat(conn, INV_READ|INV_WRITE);
    if (lobjId != -1)
    {
        cout << "Large object ID created :" << lobjId << endl;
        int lobj_fd = lo_open(conn, lobjId, INV_WRITE);
        cout << "Large object file descriptor :" << lobj_fd << endl;
        if (lobj_fd != -1)
        {
            // write the large object
            int nbytes_out = lo_write(conn, lobj_fd, chBytes, iLength);
            cout << "Large object written - no of bytes :" << nbytes_out << endl;
            (void) lo_close(conn, lobj_fd);
        }
    }

    res = PQexec(conn, "end");
    PQclear(res);
    PQfinish(conn);
}

all worked fine on the Solaris box but on the HP the lo_creat returns 0
for the oid - subsequently lo_open returns -1 when an attempt is made to
open the object.

The configuration used to install postgresql-7.3.3 on the HP environment
is as follows:

configure CC=/bin/cc AR=/bin/ar CFLAGS=+DA2.0W --without-readline
--without-zlib

Has anyone come across this problem ? Any help on this would be much
appreciated

Thanks in advance

Colm

--
**************************************************************
* Colm Dobbs                      Email: c.dobbs@aepona.com  *
* Software Engineer               Web:   www.aepona.com      *
* Aepona LTD,Interpoint Building, Phone: +44 (0)2890 269186  *
* 20-24 York Street, Belfast      Fax:   +44 (0)2890 269111  *
* BT15 1AQ N.Ireland                                         *
**************************************************************


pgsql-general by date:

Previous
From: Anthony Best
Date:
Subject: Anomaly with SUM().
Next
From: nzanella@cs.mun.ca (Neil Zanella)
Date:
Subject: PostgreSQL and ACID properties support