Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSa6q-0005vl-D6 for pgsql-general@arkaria.postgresql.org; Fri, 30 Nov 2018 04:08:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gSa6p-0002un-4v for pgsql-general@arkaria.postgresql.org; Fri, 30 Nov 2018 04:08:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSa6o-0002uf-PO for pgsql-general@lists.postgresql.org; Fri, 30 Nov 2018 04:08:54 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSa6l-00055s-J1 for pgsql-general@postgresql.org; Fri, 30 Nov 2018 04:08:53 +0000 Received: from [192.168.127.1] (port=62543 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1gSa6i-0000LV-Si; Fri, 30 Nov 2018 04:08:48 +0000 Received: from [127.0.0.1] (port=35876 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gSa6i-000ElN-1P; Fri, 30 Nov 2018 04:08:48 +0000 From: Andrew Gierth To: Moreno Andreo Cc: PostgreSQL mailing lists Subject: Re: Debian : No echo after pg_dump | psql In-Reply-To: <690144ed-bfb2-e06e-2aba-4d8e9e99edaf@evolu-s.it> (Moreno Andreo's message of "Thu, 29 Nov 2018 17:12:45 +0100") Message-ID: <87ftvjmd8m.fsf@news-spur.riddles.org.uk> References: <690144ed-bfb2-e06e-2aba-4d8e9e99edaf@evolu-s.it> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Fri, 30 Nov 2018 04:08:47 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Moreno" == Moreno Andreo writes: Moreno> The command I'm using is Moreno> root@xxxxx:~# pg_dump -v -C -h -p 6543 -U postgres Moreno> | psql -h localhost -p 6543 -U postgres 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)