Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 18FAB9F9623 for ; Tue, 21 Aug 2007 13:10:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 87224-06 for ; Tue, 21 Aug 2007 13:09:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.188]) by postgresql.org (Postfix) with ESMTP id 21F5F9F95EA for ; Tue, 21 Aug 2007 13:09:43 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id f5so1088850nfh for ; Tue, 21 Aug 2007 09:09:42 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=cRXeVnxmWSvn7maQHn/e1oyaSaSKw6ENG03DYfXW5Clj+bivqVXKhnMNM8YEzf210PUoCRmUapnJuWDMRG5Gt96ihwj9S7auqPLEDIM6OZRF28+TPlAJJeyw7072iWg1OQ+iCo27tSoOw0TAHMXPpZA7lQz7SHTBWQOdQuVZ/C4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=ZqNK1MIQgoLpTFapJj/CB6UGrnLDQlInESPasjPeVv79x1FiINmhMC0JanK2aZs7fGulkK34JX74ISOT80Ft06eSeKeoKGdJM8yUs2ln+OEdgZMtbmNmI5YgMi/f8ZzFPBwnSAc6FYGrfV0hLAlvNLiDmTjCkYVsRKujJ+fqblk= Received: by 10.78.123.5 with SMTP id v5mr2887634huc.1187712581349; Tue, 21 Aug 2007 09:09:41 -0700 (PDT) Received: by 10.78.201.16 with HTTP; Tue, 21 Aug 2007 09:09:41 -0700 (PDT) Message-ID: <1d219a6f0708210909t663a6a1al8c25bd6f76c99031@mail.gmail.com> Date: Tue, 21 Aug 2007 12:09:41 -0400 From: "Chris Hoover" To: "Scott Marlowe" Subject: Re: How to export query results Cc: "pgsql-admin@postgresql.org Admin" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11953_15547062.1187712581318" References: <1d219a6f0708210754v456fecaer68d0420cf2526c12@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/256 X-Sequence-Number: 26587 ------=_Part_11953_15547062.1187712581318 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/21/07, Scott Marlowe 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)? Thanks, Chris PG 8.1 ------=_Part_11953_15547062.1187712581318 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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)?

Thanks,

Chris

PG 8.1
------=_Part_11953_15547062.1187712581318--