Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdauv-0000QU-2K for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 15:23:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdauu-0003wS-26 for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 15:23:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdaut-0003wC-Pu for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 15:23:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdaur-00021f-PU for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 15:23:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0ADFN5UL286346; Fri, 13 Nov 2020 10:23:05 -0500 From: Tom Lane To: Jeremy Wilson cc: Adrian Klaver , pgsql-general@lists.postgresql.org Subject: Re: Issue upgrading from 9.5 to 13 with pg_upgrade: "connection to database failed: FATAL: database "template1" does not exist" In-reply-to: <6DBC6B57-422B-4A5C-8116-5615FEBC0DF7@clover.co> References: <793E4164-90E9-41F0-B74C-129E1DB76408@clover.co> <5d5bd3f7-8158-97fa-9d6e-064af852f5ec@aklaver.com> <6DBC6B57-422B-4A5C-8116-5615FEBC0DF7@clover.co> Comments: In-reply-to Jeremy Wilson message dated "Fri, 13 Nov 2020 10:13:52 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <286344.1605280985.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 13 Nov 2020 10:23:05 -0500 Message-ID: <286345.1605280985@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jeremy Wilson writes: >> On Nov 13, 2020, at 10:09 AM, Adrian Klaver = wrote: >> In your previous post you had --socketdir=3D/var/run/postgresql/. Did y= ou change that or is it missing? > Sorry, here it is with the socket directory specified. An incorrect socket-directory setting would lead to something like "could not connect to server: No such file or directory", not to a specific complaint about a database not being present. Unless ... could it be that there is another PG server active on the machine, whose cluster lacks a "template1" database? Seems unlikely, but you might try confirming with "ps auxww | grep post" or the like. I also wonder if the cluster you're trying to upgrade from has a "template1" database. Not sure if anyone has ever tested whether pg_upgrade can cope with the lack of one. regards, tom lane