A development environment was mistakenly deleted by a development classmate. When using the text backup file of pg_dump and executing psql to perform a universal restore, an error occurred:
1
2
3
4
5
6
7
8
9
|
$ psql -U postgres -W abce < abce.sql .... invalid command \N invalid command \N invalid command \N invalid command \N invalid command \N invalid command \N .... |
Turn ON_ERROR_STOP to see what errors will occur
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
$ psql -U postgres -W -v ON_ERROR_STOP=1 abce < abce.sql Password : SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET CREATE EXTENSION COMMENT ERROR: could not open extension control file "/usr/pgsql-11/share/extension/postgis.control" : No such file or directory |
Among them,
$ psql -v ON_ERROR_STOP=1
will stop when the first error is encountered.
It turns out that the machine used for temporary recovery does not have postgis installed.
After installing postgis, import the data again and the import is successful!