| From: | Sim Zacks <sim(at)compulab(dot)co(dot)il> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: pg_dump with select output |
| Date: | 2011-02-16 13:26:35 |
| Message-ID: | 4D5BD08B.90206@compulab.co.il |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 02/16/2011 11:54 AM, Adarsh Sharma wrote:
> Dear all,
>
> I am using pg_dump in Postgresql database very often and read several
> parameters of it.
> But today i want to back up that part of table which satisfies
> satisfies certain condition ( select command ).
>
> In mysql , this is achieved as below :
>
> mysqldump -h192.168.1.106 -uroot -porkash -q -w"internalurl_id between
> 1 and 30" bicrawler internalurl > /root/Desktop/internal_url.sql
>
> -w option is used for executing select command .
>
> But don't know how this is achieved through pg_dump command.
>
Not through pgdump, but you can do it with psql like such
psql -h 192.168.1.106 -d bicrawler -o /root/Desktop/internal_url.sql -P
format=unaligned -P fieldsep="|,|" -t -U postgres -c "select * from
internalurl where internalurl_id between 1 and 30 "
Note that you have to have postgres (or the user you are using)
authenticated by trust or it will ask for a password. You can't put the
password on the command line, though you can use a .pgpass file.
> Please help.
>
>
> Thanks & best Regards,
>
> Adarsh Sharma
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Aljoša Mohorović | 2011-02-16 13:28:36 | server setup/testing performance |
| Previous Message | Raymond O'Donnell | 2011-02-16 10:02:26 | Re: pg_dump with select output |