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 11:21:03 -0500
Message-ID: <dcc563d10708210921y63cbec7cyc3a0090792fcbf11@mail.gmail.com> (raw)
In-Reply-To: <1d219a6f0708210909t663a6a1al8c25bd6f76c99031@mail.gmail.com>
References: <1d219a6f0708210754v456fecaer68d0420cf2526c12@mail.gmail.com>
<dcc563d10708210833l2652ad39w165ef6a2c8207f1f@mail.gmail.com>
<1d219a6f0708210909t663a6a1al8c25bd6f76c99031@mail.gmail.com>
On 8/21/07, Chris Hoover <revoohc@gmail.com> wrote:
> On 8/21/07, Scott Marlowe <scott.marlowe@gmail.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.
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: <dcc563d10708210921y63cbec7cyc3a0090792fcbf11@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