Re: non superuser creating flat files

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Erik Jones" <erik(at)myemma(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Terri Reid" <treid(at)bct-solutions(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: non superuser creating flat files
Date: 2007-08-13 15:56:59
Message-ID: dcc563d10708130856g200167bbl70647f9f1381c61@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/13/07, Erik Jones <erik(at)myemma(dot)com> wrote:
>
> On Aug 13, 2007, at 9:50 AM, Tom Lane wrote:
>
> > "Terri Reid" <treid(at)bct-solutions(dot)co(dot)uk> writes:
> >> I have data that is being updated in a table that I need to export
> >> to a flat
> >> file via a database trigger on insert or update. The user
> >> performing the
> >> update will not be a superuser. I've tried to use COPY TO, but
> >> that doesn't
> >> work for non-superusers.
> >
> > It will if invoked in a trigger function that's marked SECURITY
> > DEFINER
> > and owned by a superuser.
>
> Also/Or, make sure the that the correct filesystem write permissions
> are set on the file/directory to which you're writing for which ever
> user whose permissions the trigger function is executed as.

The trigger will always write as the use the postgres server is
running under (typically the postgres user). You will need to make
sure that that account can write to the file and that whoever else
needs to read it can read it.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-08-13 16:08:51 Re: can i use an array as a table (in the from clause)
Previous Message John Coulthard 2007-08-13 15:34:19 Re: Unable to connect to PostgreSQL server via PHP