I have a Postgres database dump of around 20GB size. I am trying to restore it using the command:
$ psql dbname < path-to-dump
which yields this final error:
After finding these questions (2 and 3), I rerun the restoration process like so:
$ psql -v ON_ERROR_STOP=1 dbname < path-to-dump
and got the first (out of many) error that occurs during the restoration:
This is the function where the specific error occurs:
--
-- Name: documents_search_trigger(); Type: FUNCTION; Schema: public; Owner: app
--
CREATE
--
CREATE FUNCTION public.documents_search_trigger() RETURNS trigger
LANGUAGE plpgsql
AS $$
begin
new.tsv := setweight(to_tsvector(coalesce(new.name,'')), 'A');
return new;
end
$$;
After researching, I found these answers ([5], [6]). I tried to encode the dump in UTF-8 using the command iconv -f UTF-8 dump.sql > utf8dump.sql
, but again, nothing worked, as I am getting the same errors.
The postgres version of my ubuntu 20.04 machine is:
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 14.0 (Ubuntu 14.0-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
(1 row)
while the version of postgres where the dump was taken can be found in the dump itself:
$ head -15 dump.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.5
-- Dumped by pg_dump version 13.1 (Ubuntu 13.1-1.pgdg20.04+1)
I suspect there is a version mismatch problem, as I am getting more errors/warning before the invalid command \N
starts taking over. Any ideas on how to proceed from here?