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 1hlDSY-0001jZ-0q for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2019 14:20:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlDSW-0002q4-Su for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2019 14:20:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlDSW-0002px-Jh for pgsql-general@lists.postgresql.org; Wed, 10 Jul 2019 14:20:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlDSU-0004iX-Im for pgsql-general@lists.postgresql.org; Wed, 10 Jul 2019 14:20:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6AEKUHk016458; Wed, 10 Jul 2019 10:20:30 -0400 From: Tom Lane To: Ian Barwick cc: Alex Williams , "pgsql-general@lists.postgresql.org" Subject: Re: Restoring a database restores to unexpected tablespace In-reply-to: <7fd8069f-a236-4e79-477c-7313ee416407@2ndquadrant.com> References: <3YfH9uVTAd1a1GSxv8H2_mH4sPz_2a3NJgufLpjuMnMsIHd0P3uZ7GWFOD_Q9zgbX_ruyFPaRwdLw7Jncd5b7MokLdHYQMyogrhAIqnBR2o=@protonmail.com> <7fd8069f-a236-4e79-477c-7313ee416407@2ndquadrant.com> Comments: In-reply-to Ian Barwick message dated "Wed, 10 Jul 2019 11:35:15 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <16456.1562768430.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Jul 2019 10:20:30 -0400 Message-ID: <16457.1562768430@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ian Barwick writes: > On 7/10/19 2:56 AM, Alex Williams wrote: >> 3. Restore the database with this command: >> zcat /var/backup/db/mydatabase.gz |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 sudo -H -u postgres=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 psql --quiet -e -c 'SET default_tablespace =3D pg_default;' -f - my= database_test > /tmp/mydatabase_test.log > This should work. Yeah, on modern PG. But I think psql didn't support combinations of -c and -f switches until 9.6. 9.5 would simply have dropped that -c switch. regards, tom lane