Thread: large object import

large object import

From
postgre@seznam.cz
Date:
Hi all,
I am having a stored function in plperlU which is called from php script then. It select data from a table, export them
toa file and zips the file. The problem is that it should store this file into temporary table. Then it should return
someidentificator to php, so that the user can download it via php. Problem is that postgreSQL doesn't supports
server-sidelarge object operations for non superuser roles. 

Can someone please give me a suggestion how can I solve this problem. I mean if I can import the file some other way or
ifthere are some other usual procedures how to do this? 

Thanks in advance,
Lukas Houf

Re: large object import

From
"Albe Laurenz"
Date:
> postgre@seznam.cz wrote:
> I am having a stored function in plperlU which is called from
> php script then. It select data from a table, export them to
> a file and zips the file. The problem is that it should store
> this file into temporary table. Then it should return some
> identificator to php, so that the user can download it via
> php. Problem is that postgreSQL doesn't supports server-side
> large object operations for non superuser roles.

PostgreSQL supports server-side large object operations for non-superusers.

Functions that access the file system are restricted to superusers.

> Can someone please give me a suggestion how can I solve this
> problem. I mean if I can import the file some other way or if
> there are some other usual procedures how to do this?

You can create a function with SECURITY DEFINER that is owned
by a superuser. That way you can make certain restricted functionality
available to regular users. You should be careful and as restrictive
as possible when writing such functions.

Yours,
Laurenz Albe

Re: [GENERAL] large object import

From
postgre@seznam.cz
Date:
> ------------ Původní zpráva ------------
> Od: Albe Laurenz <laurenz.albe@wien.gv.at>
> Předmět: Re: [GENERAL] large object import
> Datum: 10.3.2008 08:44:30
> ----------------------------------------
> > postgre@seznam.cz wrote:
> > I am having a stored function in plperlU which is called from
> > php script then. It select data from a table, export them to
> > a file and zips the file. The problem is that it should store
> > this file into temporary table. Then it should return some
> > identificator to php, so that the user can download it via
> > php. Problem is that postgreSQL doesn't supports server-side
> > large object operations for non superuser roles.
>
> PostgreSQL supports server-side large object operations for non-superusers.
>
> Functions that access the file system are restricted to superusers.
>
> > Can someone please give me a suggestion how can I solve this
> > problem. I mean if I can import the file some other way or if
> > there are some other usual procedures how to do this?
>
> You can create a function with SECURITY DEFINER that is owned
> by a superuser. That way you can make certain restricted functionality
> available to regular users. You should be careful and as restrictive
> as possible when writing such functions.
>
> Yours,
> Laurenz Albe
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>

Hi,
thank you very much, this helped a lot. It works fine.

Lukas Houf