Re: [PDO] LOBs in pgsql
[email protected] (Lukas Kahwe Smith) Wed, 9 Jul 2008 21:30:05 +0200
| Newsgroups | php.pdo |
|---|---|
| Message-ID | <[email protected]> |
On 09.07.2008, at 05:20, Jeremy wrote: > Looking through the pdo_pgsql code, I can see why this is: it makes > a decision about LOB handling based on whether you are using the > "distant" (or oid) method, or the bytea column method. If you are > using the former, it uses the appropriate functions to open a stream > resource to the object and all is good. However, if you are using > the latter, it tries to allocate memory for the entire lob and > unescape it all at once. Obviously, this fails miserably in my > case, or I wouldn't be posting here :-) > > I could increase the memory_limit to be larger than a LOB will ever > be. But what if this were gigabytes? Am I tied to the "distant" > method, which is not particularly relational and ignores all concept > of permissions? I feel like the behavior should be able to be > overridden in the driver options or some such, but there is > obviously no way to do that. > > The true LOB (using the distant method) functions use the lo_* > functions from libpq behind the scenes, so obviously this is not > possible with bytea fields. However, there must be some way to use > a buffered reader to avoid over-allocation here. Its my understanding that this is simply the fault of PostgreSQL at this point, since they have not provided a streaming API for bytea. The only way to do it would be for us to emulate it, which I think is probably not a high priority given the general lack of ressources around PDO. So unless you want to step up and do this .. regards, Lukas Kahwe Smith [email protected]