Re: Debian : No echo after pg_dump | psql

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: Debian : No echo after pg_dump | psql
Дата
Msg-id 87ftvjmd8m.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Debian : No echo after pg_dump | psql  (Moreno Andreo <moreno.andreo@evolu-s.it>)
Ответы Re: Debian : No echo after pg_dump | psql  (Moreno Andreo <moreno.andreo@evolu-s.it>)
Список pgsql-general
>>>>> "Moreno" == Moreno Andreo <moreno.andreo@evolu-s.it> writes:

 Moreno> The command I'm using is
 Moreno> root@xxxxx:~# pg_dump -v -C -h <remote host> -p 6543 -U postgres
 Moreno> <dbname> | psql -h localhost -p 6543 -U postgres <dbname>
 Moreno> It presents a double password prompt after I run it:
 Moreno> Password: Password for user postgres:

This is going to prompt once for the remote host's password and twice
for the local one (because -C), and the concurrently-running commands
are going to be fighting over access to the terminal to do it. Best
avoided by using pgpass or non-password-based auth methods.

More seriously, you're misunderstanding how -C works. When you use -C,
the database you specify to psql (or pg_restore) is NOT the database
you're restoring into - the restored db will ALWAYS have the same name
as it had when dumped (if that's not what you want then don't use -C).
Instead, the database you specify to psql or pg_restore is the database
to connect to to issue the CREATE DATABASE command, which should usually
be 'postgres'. That explains this bit:

 Moreno> If I create database (just database, not schema) on target
 Moreno> machine, I receive the error "database xxxx already exists" but
 Moreno> the dump goes on If I don't create it, I receive the error
 Moreno> "database xxxx does not exist" and processing aborts.

-- 
Andrew (irc:RhodiumToad)


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Debian : No echo after pg_dump | psql
Следующее
От: Chris Withers
Дата:
Сообщение: Re: surprising query optimisation