Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E541D636348 for ; Wed, 10 Jun 2009 03:02:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94000-04-2 for ; Wed, 10 Jun 2009 03:02:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mail.postgresql.org (Postfix) with ESMTP id 6299E636216 for ; Wed, 10 Jun 2009 03:02:52 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 8so316342qwh.61 for ; Tue, 09 Jun 2009 23:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=1yz+I4x1VpmZRv3Nd4rm+A8tFivbTW/TdN/UjyIr3JU=; b=xTP8YGR0TKF0FCo5esxoLLIprp6ga2/w+wri41gCVENPeWNrewot7WDR56nzrU+74a BIBzr3mZ+ltZ43byIBz2AiIrXbJ1nTIdRBmsi0AVXAV6Wr2pNdvYBfColku9IB8mm63p J6qOFH+8sY7k7kEkPNy6k+VoWQndO512aBxoE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=esTmDQsWudOQRXraa14Ro56np3PvjZBbCqydxPYeFJ99HyjAbAWbVDrTW0+qFPk0pG Dn+kvc5cmHlppVgCUyWWgmkdWtfv9TJn1/sNoZHl9cUY0OdsK44z8dlYMJYqWFw/+WjY D49bcsaJuKex5+BEr446uROM4RqfhSIv2DIMk= MIME-Version: 1.0 Received: by 10.229.97.14 with SMTP id j14mr220041qcn.102.1244613771531; Tue, 09 Jun 2009 23:02:51 -0700 (PDT) In-Reply-To: <001b01c9e989$821d7610$86586230$@com> References: <003b01c9e8e8$29f09860$7dd1c920$@com> <001b01c9e989$821d7610$86586230$@com> Date: Wed, 10 Jun 2009 11:32:51 +0530 Message-ID: Subject: Re: backup From: Abbas To: Jyoti Seth Cc: Jasen Betts , pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=0016364ef4d6bc1a42046bf839a4 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200906/44 X-Sequence-Number: 32649 --0016364ef4d6bc1a42046bf839a4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Wed, Jun 10, 2009 at 10:38 AM, Jyoti Seth 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@postgresql.org [mailto: > pgsql-sql-owner@postgresql.org] > On Behalf Of Jasen Betts > Sent: Tuesday, June 09, 2009 6:03 PM > To: pgsql-sql@postgresql.org > Subject: Re: [SQL] backup > > On 2009-06-09, Jyoti Seth 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@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > --0016364ef4d6bc1a42046bf839a4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Wed, Jun 10, 2009 at 10:38 AM, Jyoti = Seth <jyoti= seth2001@gmail.com> wrote:
I tried using /copy command. It is not giving any error but also not
creating any file.

Thanks
Jyoti

=A0 =A0 =A0 =A0 U= se copy command as follows if the OS is Linux,

postgres=3D# copy (se= lect * from test where setid>20) to '/var/tmp/t2.dmp';
COPY 3=
postgres=3D# \q
-bash-3.1$ cat /var/tmp/t2.dmp
1234=A0=A0=A0 22=A0=A0=A0=A0=A0 1=A0=A0= =A0=A0=A0=A0 2009-01-08 00:00:00=A0=A0=A0=A0 dup1-2
9876=A0=A0=A0 21=A0= =A0=A0=A0=A0 1=A0=A0=A0=A0=A0=A0 2009-01-10 00:00:00=A0=A0=A0=A0 dup2-1
= 1=A0=A0=A0=A0=A0=A0 21=A0=A0=A0=A0=A0 1=A0=A0=A0=A0=A0=A0 2009-01-10 00:00:= 00=A0=A0=A0=A0 dup2-1
=A0
If it is Windows, use can use as,

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



Thanks,Abbas
EnterpriseDB




-----Original Message-----
From: pgsql-sql-owner@pos= tgresql.org [mailto:p= gsql-sql-owner@postgresql.org]
On Behalf Of Jasen Betts
Sent: Tuesday, June 09, 2009 6:03 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] backup

On 2009-06-09, Jyoti Seth <
jy= otiseth2001@gmail.com> wrote:
> This is a multipart message in MIME format.
>
> ------=3D_NextPart_000_003C_01C9E916.43A8D460
> Content-Type: text/plain;
> =A0 =A0 =A0 charset=3D"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 >=3D 8.2 IIRC.

you can use any query.

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
= http://www.postgresql.org/mailpref/pgsql-sql


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
= http://www.postgresql.org/mailpref/pgsql-sql

--0016364ef4d6bc1a42046bf839a4--