Re: How to export query results

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Chris Hoover" <revoohc(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org Admin" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: How to export query results
Date: 2007-08-21 15:33:38
Message-ID: dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 8/21/07, Chris Hoover <revoohc(at)gmail(dot)com> wrote:
> I need some guidance.
>
> I need to have an after insert trigger execute on a specific table and
> export the results of query to a file on the database file system. Is this
> possible to do from a trigger? If so, how can I accomplish this? I am
> drawing a blank on how to export the results of the query.

Yes. you need to use the copy command inside a function and use
security definer to say that the function runs as a superuser.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2007-08-21 15:34:53 Re: Dump & Load a database???
Previous Message Scott Marlowe 2007-08-21 15:30:24 Re: how to call sql code without function