pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Chris Hoover <revoohc@gmail.com>
Cc: pgsql-admin@postgresql.org Admin <pgsql-admin@postgresql.org>
Subject: Re: How to export query results
Date: Tue, 21 Aug 2007 10:33:38 -0500
Message-ID: <dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com> (raw)
In-Reply-To: <1d219a6f0708210754v456fecaer68d0420cf2526c12@mail.gmail.com>
References: <1d219a6f0708210754v456fecaer68d0420cf2526c12@mail.gmail.com>

On 8/21/07, Chris Hoover <revoohc@gmail.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.



view thread (4+ messages)  latest in thread

Message-ID: <dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com>
Permalink:  ../dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, revoohc@gmail.com
  Subject: Re: How to export query results
  In-Reply-To: <dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox