Re: Export SELECT statement as SQL queries in file - Mailing list pgsql-novice

From Sean Davis
Subject Re: Export SELECT statement as SQL queries in file
Date
Msg-id 200705040956.03630.sdavis2@mail.nih.gov
Whole thread Raw
In response to Export SELECT statement as SQL queries in file  ("Mario Peshev" <nofearinc@gmail.com>)
List pgsql-novice
On Friday 04 May 2007 09:45, Mario Peshev wrote:
> Hey there,
>
> I'm interested in getting the content of a SQL query into a file (possibly
> as an INSERT clause). Is it possible to be done with an SQL statement? Now
> I think it could be realised as [\copy (statement) to 'file'] construction,
> but it's psql command. Is there another way?

There is also a server-side copy:

http://www.postgresql.org/docs/current/static/sql-copy.html

Otherwise, you will need to use a client (of which there are many).  Also, at
least perl, python, and java all have readily accessible client modules, so
you can write short scripts to do what you want.

Sean

pgsql-novice by date:

Previous
From: "Mario Peshev"
Date:
Subject: Export SELECT statement as SQL queries in file
Next
From: "Christian Leclerc"
Date:
Subject: Trigger and Notify