Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHYbu-008R3O-8v for pgsql-general@arkaria.postgresql.org; Sun, 01 Dec 2024 01:18:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tHYar-003IcM-25 for pgsql-general@arkaria.postgresql.org; Sun, 01 Dec 2024 01:17:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHYaq-003IcD-LK for pgsql-general@lists.postgresql.org; Sun, 01 Dec 2024 01:17:49 +0000 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHYan-000OqO-Dl for pgsql-general@postgresql.org; Sun, 01 Dec 2024 01:17:48 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Y18D00TG0z9sqs; Sun, 1 Dec 2024 02:17:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1733015856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E2FyRPgbfyHtSOdtEE53HeaxpxG1eBlX2wFXOP/fJsI=; b=CaTDXA6shcA8qQKFehtsUJLyBggDm/a9gCqhKDDJggJfKMZDLqXXe8K70I7PqnLMsCiBvL ZTMaycxuuCid9ABU6sP/umEbc8Ut7gL+6OeIt1/LrnFQ1FFaxCypGrJuEmiYAOKfy/HK8M r5/vpyGaR1cjfH8/KMtQXB9sV6H6gPXzPjiGwAaZrmK+waRKq8+Y5IDiYO0AjhLCFXJ+IZ k95aMK33jLF5Tl1OcvVOGI1OH3kk0nFXN4X0fGTEQJJ/jZndl4qdQdj2LovFSAZfK8uZeG zIqAET8neZS8tyZEHK+QWJcQHl0dZsS73UYKNYpLmZ+F4CgxipAGlEbqh4r+Ag== Message-ID: <9c5ba566-27b8-4e8c-bf7d-2dc561509991@mailbox.org> Date: Sat, 30 Nov 2024 17:17:31 -0800 MIME-Version: 1.0 From: PopeRigby Subject: Re: Errors when restoring backup created by pg_dumpall To: Adrian Klaver , pgsql-general@postgresql.org References: <6a6439f1-8039-44e2-8fb9-59028f7f2014@mailbox.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-MBO-RS-ID: ef762ada4598e20c010 X-MBO-RS-META: 9xj8cyf677pqgxgtgmo999gxdams3s1h List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/29/24 17:47, Adrian Klaver wrote: > On 11/29/24 17:34, PopeRigby wrote: >> My HDD recently failed so I'm trying to restore my backup, but I'm >> running into some errors. >> >> I've been using a systemd service that periodically backs up my >> cluster with pg_dumpall, and I'm using this command to restore: >> >> sudo psql -f backup.sql postgres >> >> I'm getting this output: >> https://gist.github.com/poperigby/d5a0103b9de1eba95aba783007e557ea > > > psql:all.sql:4104: ERROR:  type "earth" does not exist > LINE 1: ...ians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth > > QUERY:  SELECT > cube(cube(cube(earth()*cos(radians($1))*cos(radians($2))),earth()*cos(radians($1))*sin(radians($2))),earth()*sin(radians($1)))::earth > CONTEXT:  SQL function "ll_to_earth" during inlining > > CREATE TABLE public.geodata_places ( >     id integer NOT NULL, >     name character varying(200) NOT NULL, >     longitude double precision NOT NULL, >     latitude double precision NOT NULL, >     "countryCode" character(2) NOT NULL, >     "admin1Code" character varying(20), >     "admin2Code" character varying(80), >     "modificationDate" date NOT NULL, >     "earthCoord" public.earth GENERATED ALWAYS AS > (public.ll_to_earth(latitude, longitude)) STORED, >     "admin1Name" character varying, >     "admin2Name" character varying, >     "alternateNames" character varying > ); > > > Looks like an extension or extensions where not installed before the > restore was done. > > >> >> This is my (redacted) database dump: >> https://gist.github.com/poperigby/fcb59eb6c22c6051800e06a0ec482b49 >> >> > Weird, I have all the same software that was installed before I restored, as I'm using NixOS. I'm guessing the earth type is provided by earthdistance, and in the SQL script it's able to successfully install cube, vector, and earthdistance. I think earthdistance and cube are actually built-in modules, right? I ran the following commands, and earth is even one of the listed types: postgres=# CREATE EXTENSION earthdistance; CREATE EXTENSION postgres=# SELECT t.typname FROM pg_catalog.pg_type t JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace JOIN pg_catalog.pg_extension e ON e.extnamespace = n.oid WHERE e.extname = 'earthdistance';  typname ---------  _cube  _earth  cube  earth (4 rows) The earthdistance module is even getting added between the table with the earth type is added, so shouldn't there be no problem?