From: | David Helgason <david(at)uti(dot)is> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: SPI question (or not): trying to read from Large Objects from within a function |
Date: | 2004-01-07 05:22:33 |
Message-ID: | 7F6484AA-40D1-11D8-BF3E-000A9566DA8A@uti.is |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you very much,
I figured I needed to open my own using SPI_connect(). I had assumed
that there was sth like a
the-connection-this-functions-is-begin-run-through.
Now I'm having problems with
size_t inBufSize = 8192;
char* inBuffer = (char*)palloc(inBufSize);
int bytes_read = DatumGetInt32(DirectFunctionCall3(loread,
Int32GetDatum(fd), CStringGetDatum(inBuffer),
UInt32GetDatum(inBufSize)));
which returns an extremely large number in bytes_read (consistently
46235672), regardless of the contents of inBufSize.
I tried using lo_lseek(fd, 0, SEEK_END) on this fd already, which
correctly returned the size of the Large Object, so it's not a question
of an invalid descriptor. Also that seek didn't effect the result at
all. I guess it's wrong usage of the DatumGet*() / *GetDatum()
functions, but I can't see where.
Any suggestions?
d.
On 7. jan 2004, at 05:40, Tom Lane wrote:
> David Helgason <david(at)uti(dot)is> writes:
>> I'm having trouble finding out how to find the current PGconn
>> connection inside a C function.
>
> What makes you think that "*the* current PGconn" is a valid concept?
> libpq has always supported multiple active connections.
>
> regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if
> your
> joining column's datatypes do not match
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jiri D. Hoogeveen | 2004-01-07 05:31:43 | unsubscribe |
Previous Message | Ezra Epstein | 2004-01-07 05:04:01 | Re: Any way to have CREATEUSER privs without having all privs? |