Thread: Large Objects, anyone?

Large Objects, anyone?

From
Andreas Kostyrka
Date:
Hi!

I'm having problems with postgresql 6.3.2 (RH 5.x vintage). The following
program should probably work, but it doesn't:
import pg,sys,string

c=pg.connect("test",None,-1,None,None)
if len(sys.argv)==1:
    c.query("BEGIN")
    lo=c.locreate(pg.INV_READ|pg.INV_WRITE)
    lo.open(pg.INV_WRITE)

    lo.write("TESTing")
    lo.close()
#    lo=c.loimport("/etc/sendmail.cf")
    print lo.oid
    c.query("END;")
else:
    c.query("BEGIN")
    lo=c.getlo(string.atoi(sys.argv[1]))
    lo.open(pg.INV_READ)
    print lo.read(102400)
    c.query("END;")


The funny thing is, that the object is created, but the lo.write() seems
to be ignored :(

BUT when using loimport, the contents get into the db.

Even more fun, the testlo.c example in the postgresql source core dumps on
the PQexec("end") line :(

Andreas
--
Win95: n., A huge annoying boot virus that causes random spontaneous system
     crashes, usually just before saving a massive project.  Easily cured by
     UNIX.  See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.