Thread: How to dump data from database?

How to dump data from database?

From
go
Date:
Hi!

 Tell me please is there any way to dump data from current session
 (instead of using pg_dump) ?

igor                          mailto:go@ugnn.ru


Re: How to dump data from database?

From
Michael Fuhr
Date:
On Mon, Apr 04, 2005 at 11:18:08AM +0400, go wrote:
>
>  Tell me please is there any way to dump data from current session
>  (instead of using pg_dump) ?

What exactly are you trying to do?  Will COPY (or psql's \copy) do
what you want?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: How to dump data from database?

From
go
Date:
 I would like to "pg_dump -Fc MyDataBase>archiv.dat"  ( maybe there is
any SQL command or something else) .
in case with COPY command I have to copy each table one by one.

 And pls one small question - what query will return me a list
 of tables in database ( \l - works only in psql)?

 Thanks!

MF> On Mon, Apr 04, 2005 at 11:18:08AM +0400, go wrote:
>>
>>  Tell me please is there any way to dump data from current session
>>  (instead of using pg_dump) ?

MF> What exactly are you trying to do?  Will COPY (or psql's \copy) do
MF> what you want?


Re: How to dump data from database?

From
John DeSoi
Date:
On Apr 4, 2005, at 5:11 AM, go wrote:

>  And pls one small question - what query will return me a list
>  of tables in database ( \l - works only in psql)?

Startup of psql with the -E option (or use \set ECHO_HIDDEN 1). Then
psql will show you the query it uses for \l or any other \ command.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: How to dump data from database?

From
Michael Fuhr
Date:
On Mon, Apr 04, 2005 at 01:11:20PM +0400, go wrote:
>
>  I would like to "pg_dump -Fc MyDataBase>archiv.dat"  ( maybe there is
> any SQL command or something else) .
> in case with COPY command I have to copy each table one by one.

I suppose you could write a function in a procedural language like
PL/Perl, PL/Python, or PL/Tcl that runs pg_dump, but why do you
need to do this from SQL?  Why can't you just run pg_dump from
outside the database?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: How to dump data from database?

From
Michael Fuhr
Date:
[Please copy the mailing list on replies.]

On Tue, Apr 05, 2005 at 08:07:47AM +0400, go wrote:
> MF> On Mon, Apr 04, 2005 at 01:11:20PM +0400, go wrote:
> >>
> >>  I would like to "pg_dump -Fc MyDataBase>archiv.dat"  ( maybe there is
> >> any SQL command or something else) .
> >> in case with COPY command I have to copy each table one by one.
>
> MF> I suppose you could write a function in a procedural language like
> MF> PL/Perl, PL/Python, or PL/Tcl that runs pg_dump, but why do you
> MF> need to do this from SQL?  Why can't you just run pg_dump from
> MF> outside the database?
>
> Pls, write a small sample of the function .

Could you tell us why you want to run pg_dump from SQL?  What problem
are you trying to solve?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: How to dump data from database?

From
go
Date:
Hi, Michael.

 I would like to add the possibility of archiving database from
 application. I cannt add archiving in schedule - because
 there is no server running all day round . And in the end of day
 any user can dump database when neccesary.
 (there is some problems with running script which can pg_dump
 database . the problem is : windows applications , such as
 pg_dump.exe make all messages in wrong encoding in russian and i
 cannt explane dummy users what to do)

Thanks for replay!

MF> Could you tell us why you want to run pg_dump from SQL?  What problem
MF> are you trying to solve?




--

go                        mailto:go@ugnn.ru