Re: backup

From: Abbas <abbas(dot)dba(at)gmail(dot)com>
To: Jyoti Seth <jyotiseth2001(at)gmail(dot)com>
Cc: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>, pgsql-sql(at)postgresql(dot)org
Subject: Re: backup
Date: 2009-06-10 06:02:51
Message-ID: bb2cdf790906092302l162db47dm4f60d4e9bf50f9d5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jun 10, 2009 at 10:38 AM, Jyoti Seth <jyotiseth2001(at)gmail(dot)com>wrote:

> I tried using /copy command. It is not giving any error but also not
> creating any file.

> Thanks
> Jyoti

Use copy command as follows if the OS is Linux,

postgres=# copy (select * from test where setid>20) to '/var/tmp/t2.dmp';
COPY 3
postgres=# \q
-bash-3.1$ cat /var/tmp/t2.dmp
1234 22 1 2009-01-08 00:00:00 dup1-2
9876 21 1 2009-01-10 00:00:00 dup2-1
1 21 1 2009-01-10 00:00:00 dup2-1

If it is Windows, use can use as,

postgres=# copy (select *from test where a<6) to 'C:/Program
Files/PostgreSQL/8.3/data/samp.sql';
COPY 9

Thanks,
Abbas
EnterpriseDB

>
> -----Original Message-----
> From: pgsql-sql-owner(at)postgresql(dot)org [mailto:
> pgsql-sql-owner(at)postgresql(dot)org]
> On Behalf Of Jasen Betts
> Sent: Tuesday, June 09, 2009 6:03 PM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] backup
>
> On 2009-06-09, Jyoti Seth <jyotiseth2001(at)gmail(dot)com> wrote:
> > This is a multipart message in MIME format.
> >
> > ------=_NextPart_000_003C_01C9E916.43A8D460
> > Content-Type: text/plain;
> > charset="us-ascii"
> > Content-Transfer-Encoding: 7bit
> >
> > Hi all,
> >
> >
> >
> > Can we take backup of specific data of a table (using where clause)?
>
> in psql:
>
> /copy (select * from table WHERE condition ) to 'FILENAME'
>
> requires postgres version >= 8.2 IIRC.
>
> you can use any query.
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

  • Re: backup at 2009-06-10 05:08:30 from Jyoti Seth

Browse pgsql-sql by date

  From Date Subject
Next Message johnf 2009-06-10 12:19:34 setting the where clause
Previous Message Gurjeet Singh 2009-06-10 05:50:28 Re: backup