From: | richard terry <rterry(at)pacific(dot)net(dot)au> |
---|---|
To: | PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Postgres blob question - insert from basic. |
Date: | 2009-11-23 11:11:01 |
Message-ID: | 200911232211.01227.rterry@pacific.net.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Yves F. Barbier | 2009-11-23 14:05:20 | Re: Postgres blob question - insert from basic. |
Previous Message | Jean-Yves F. Barbier | 2009-11-21 23:35:05 | Re: Data access and user id |