Postgres blob question - insert from basic.

Поиск
Список
Период
Сортировка
От richard terry
Тема Postgres blob question - insert from basic.
Дата
Msg-id 200911232211.01227.rterry@pacific.net.au
обсуждение исходный текст
Ответы Re: Postgres blob question - insert from basic.
Список 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 по дате отправления:

Предыдущее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Data access and user id
Следующее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Postgres blob question - insert from basic.