From: | Siva Palanisamy <siva_p(at)hcl(dot)com> |
---|---|
To: | Chris Travers <chris(dot)travers(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to write a psql command inside a function? |
Date: | 2011-08-17 05:45:02 |
Message-ID: | 90F0F47595235141A4380FCF01B0185B20BC49F09D@CHN-HCLT-EVS07.HCLT.CORP.HCL.IN |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Chris,
I don't have super-user. So I knew I can go with only \COPY command. I want to export the data from a table to a .CSV file. It worked fine when this command is used as a stand-alone. Now, I want to embed this line inside a function. Is there any alternative way for my requirement? Please guide me. John has proposed to see COPY to STDOUT which I am not aware of, and started looking into it. However, the operations I said above have suppose to be done only on the database side!
Thanks and Regards,
Siva.
-----Original Message-----
From: Chris Travers [mailto:chris(dot)travers(at)gmail(dot)com]
Sent: Wednesday, August 17, 2011 11:12 AM
To: Siva Palanisamy
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] How to write a psql command inside a function?
On Tue, Aug 16, 2011 at 10:33 PM, Siva Palanisamy <siva_p(at)hcl(dot)com> wrote:
> Hi All,
>
>
>
> I want to have a psql command '\COPY' inside a function. By default, this
> command works as such. But, not inside a function. Please guide me.
>
I don't think that works I think you have to use SQL commands since,
well, the function is running in the db, not in your client.
Look up the SQL COPY command instead.
Best Wishes,
Chris Travers
::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.
-----------------------------------------------------------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Sim Zacks | 2011-08-17 06:05:44 | Re: Using Postgresql as application server |
Previous Message | Chris Travers | 2011-08-17 05:42:03 | Re: How to write a psql command inside a function? |