Re: Copy command to handle view for my export requirement

From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: Siva Palanisamy <siva_p(at)hcl(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Copy command to handle view for my export requirement
Date: 2011-08-11 11:25:09
Message-ID: CA+h6AhgT_xiiaY0FPaDjNh5jFv9Gxq7XBwLeH=2y_-p94iJurw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nope, you need to be in latest version as Andreas said.
---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/

On Thu, Aug 11, 2011 at 4:51 PM, Siva Palanisamy <siva_p(at)hcl(dot)com> wrote:

> Hi Andreas,
>
> FYI, I am using PostgreSQL 8.1.4.
>
> Thanks and Regards,
> Siva.
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:
> pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Siva Palanisamy
> Sent: Thursday, August 11, 2011 4:48 PM
> To: Andreas Kretschmer; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Copy command to handle view for my export
> requirement
>
> Hi Andreas,
>
> I tried the command as below. It failed. Please correct me.
>
> \copy (select * from view1) to '/sample.csv' delimiters ',' csv header;
> ERROR: \copy: parse error at "select"
>
> Thanks and Regards,
> Siva.
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:
> pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Andreas Kretschmer
> Sent: Thursday, August 11, 2011 2:23 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Copy command to handle view for my export
> requirement
>
> Siva Palanisamy <siva_p(at)hcl(dot)com> wrote:
>
> > Hi All,
> >
> >
> >
> > I understand that copy and \copy commands in PostgreSQL work only for
> tables. I
> > want it to export the data from varies tables. Instead, I can create a
> view for
> > the list of tables. Can the copy or \copy commands be utilized to operate
> on
> > views directly? Please let me know on this.
>
> Sure, you can do that (with recent versions) with:
>
> copy (select * from your_view) to ...
>
>
> Andreas
> --
> Really, I'm not out to destroy Microsoft. That will just be a completely
> unintentional side effect. (Linus Torvalds)
> "If I was god, I would recompile penguin with --enable-fly." (unknown)
> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
> ::DISCLAIMER::
>
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its
> affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect
> the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and / or publication of
> this message without the prior written consent of the author of this e-mail
> is strictly prohibited. If you have
> received this email in error please delete it and notify the sender
> immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
>
> -----------------------------------------------------------------------------------------------------------------------
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Boszormenyi Zoltan 2011-08-11 11:40:39 Re: Copy command to handle view for my export requirement
Previous Message Siva Palanisamy 2011-08-11 11:21:55 Re: Copy command to handle view for my export requirement