Обсуждение: lo_export

Поиск
Список
Период
Сортировка

lo_export

От
Steve Tucknott
Дата:
PostGreSQL 7.4.5 (RedHat 8)

We have images stored in the database, that our application allows the user to export (using lo_export), update, and then reimport. How do I get around the permissions issue?
The user connects to the database as, say, 'user1' - this is fine. The lo_export (server command) exports as postgres::users with permissions of 644. User1, cannot then edit the image, as they do not have permission.

Is there a way of changing postgres's (lo_export's?) default umask? I have tried changing it in /etc/profile (targetted at postgres LOGNAME) - in the .bash_profile for postgres, and also in pg_ctl (for the start up) - but I can't appear to change it. So presumably, there's another way of doing this?

PS I've also tried setting the target directory as g+s - that's ok to the point that the file is then created with the group of the directory - but obviously still not correct permissions to edit the file.


Regards,

Steve Tucknott

ReTSol Ltd

DDI: 01903 828769

Re: lo_export

От
Tom Lane
Дата:
Steve Tucknott <steve@retsol.co.uk> writes:
> We have images stored in the database, that our application allows the
> user to export (using lo_export), update, and then reimport. How do I
> get around the permissions issue?

Do the lo_export and lo_import on the client side, not the server side.
IIRC psql has a "\lo_export" command, and there's definitely a function
for it in libpq.

            regards, tom lane