FAQ
I am using pgSQL 8.1.4. I have a table that stores pictures, using an oid
column.

Now using the SQL functions provided I have successfully saved an image to
the table, and managed to export it from the table again.



I am battling to open the image for reading into a stream. The mentioned
functions support opening for exporting a file in SQL are






SELECT lo_export(image.raster, '/tmp/motd') FROM image
WHERE name = 'beautiful image';





But how do I open a stream for reading?






inv_fd = lo_open(conn, inv_oid, INV_READ|INV_WRITE);

I have tried to convert this into a SQL statement but INV_READ is not seen
as an accepted parameter.

Search Discussions

  • Tom Lane at Jun 5, 2006 at 2:55 pm

    "Greg" <greg@officium.co.za> writes:
    I am battling to open the image for reading into a stream.
    From what? The lo_xxx functions are intended to be used from C, not
    from SQL.

    You might be better off using a bytea column, which is a far simpler
    construct than a large object. It won't give you streamwise access,
    just fetch or store the whole value at once, but that might be all you
    need.

    regards, tom lane
  • Greg at Jun 5, 2006 at 5:21 pm
    Thanks, I read the pgAdmin help on a bytea column, but it doesn't specify its maximum size. What is
    the largest filesize I can fit into a bytea column?

    Thanks

    ----- Original Message -----
    From: Tom Lane
    To:
    Cc: pgsql-novice@postgresql.org
    Sent: Mon, 05 Jun 2006 10:55:26 -0400
    Subject: Re: [NOVICE] Display large object from database

    "Greg" <greg@officium.co.za> writes:
    I am battling to open the image for reading into a stream.
    From what? The lo_xxx functions are intended to be used from C, not
    from SQL.

    You might be better off using a bytea column, which is a far simpler
    construct than a large object. It won't give you streamwise access,
    just fetch or store the whole value at once, but that might be all you
    need.

    regards, tom lane
  • Tom Lane at Jun 5, 2006 at 6:00 pm

    <greg@officium.co.za> writes:
    Thanks, I read the pgAdmin help on a bytea column, but it doesn't specify its maximum size. What is
    the largest filesize I can fit into a bytea column?
    The hard limit is 1Gb. Practical limit is probably a good deal less,
    depending on your machine, but I don't know of anyone who's tried to
    measure performance with such wide column values.

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJun 5, '06 at 12:27p
activeJun 5, '06 at 6:00p
posts4
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Greg: 2 posts Tom Lane: 2 posts

People

Translate

site design / logo © 2022 Grokbase