Postgres blob question - insert from basic. - Mailing list pgsql-novice

From richard terry
Subject Postgres blob question - insert from basic.
Date
Msg-id 200911232211.01227.rterry@pacific.net.au
Whole thread Raw
Responses Re: Postgres blob question - insert from basic.  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
List pgsql-novice
I'm confused about permissions to use lo_import/export:

Docs say this:

        test=> CREATE TABLE fruit (name CHAR(30), image OID);
        CREATE
        test=> INSERT INTO fruit
        test-> VALUES ('peach', lo_import('/usr/images/peach.jpg'));
        INSERT 27111 1
        test=> SELECT lo_export(fruit.image, '/tmp/outimage.jpg')
        test-> FROM   fruit
        test-> WHERE  name = 'peach';
         lo_export
        -----------
                 1
        (1 row)

        test=> SELECT lo_unlink(fruit.image) FROM fruit;
         lo_unlink
        -----------
                 1
        (1 row)

However I want to do this in code (gambas basic), so i've a query where I've
selected a picture from a popup dialog. (Moddbconnect.Exec-Query is just a
function I have to do the database work and works for everything else, so that
is not the problem).

sql = "INSERT INTO demo_blob VALUES( 'my picture', lo_import('"
     sql &= Dialog.Path & "'))"
     modDBConnect.exec_query(sql)

This bombs, saying I don't have permission as super-user.

The doc's say use psql \lo_import, but I've no idea how to use this within a
query from basic.

Any help appreciated, thanks in advance.

Regards

Richard

pgsql-novice by date:

Previous
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Data access and user id
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Postgres blob question - insert from basic.