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 16:21:03
Message-ID: dcc563d10708210921y63cbec7cyc3a0090792fcbf11@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:
> On 8/21/07, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> >
> > Yes. you need to use the copy command inside a function and use
> > security definer to say that the function runs as a superuser.
> >
>
>
> Ok, I thought from the documentation that copy could only extract entire
> table or a specific column.
>
> If I want to extract this:
>
> select x.name,x.create_date
> from x
> where x.id = new.id
>
> how do I get copy to do this (simple example, I know)?

Well, there are a couple of ways to approach this. One is to select
it into a temp table and then copy that to a file. Another would be
to use an untrusted pl language (plperlu etc...) to do it.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Medi Montaseri 2007-08-21 17:16:12 ROI on 7.2 to 8.2
Previous Message Chris Hoover 2007-08-21 16:09:41 Re: How to export query results