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



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

Reply via email to