我想导入一个.sql
数据库转储到我的postgres 9.6.1
。我已经尝试了命令行以及Postico GUI,但是在导入时会出现大量错误(如数千行错误)。Postgres SQL转储许多语法和权限错误导入
SQL转储来自运行postgres 9.4.5
的同事,并且SQL看起来有效。 4.2.1(基于苹果公司
在x86_64-苹果达尔文的PostgreSQL 9.6.1,通过 的i686-苹果darwin11-LLVM-GCC-4.2(GCC)编译:
我的Postgres版本。 构建5658)(LLVM构建2336.11.00),64位
我已经试过以下进口:
psql -U postgres dbname < ~/Desktop/dbname_local_db_20161122.sql
然后登录并试图:
psql -U postgres dbname
dbname=# \i ~/Desktop/dbname_local_db_20161122.sql
错误:(还有比这样更多)就像我说的
Password for user postgres:
SET
SET
SET
SET
SET
SET
CREATE EXTENSION
COMMENT
ERROR: schema "public" does not exist
ERROR: extension "citext" does not exist
ERROR: schema "public" does not exist
ERROR: extension "pg_trgm" does not exist
SET
ERROR: function "add_session_metric" already exists with same argument types
ERROR: role "myrole" does not exist
ERROR: function "session_metrics_partition_creation" already exists with same argument types
ERROR: role "myrole" does not exist
ERROR: function "session_metrics_partition_function" already exists with same argument types
ERROR: role "myrole" does not exist
SET
SET
ERROR: permission denied to create "pg_catalog.messages"
DETAIL: System catalog modifications are currently disallowed.
ERROR: relation "messages" does not exist
ERROR: permission denied to create "pg_catalog.Message_id_seq"
DETAIL: System catalog modifications are currently disallowed.
ERROR: relation "Message_id_seq" does not exist
ERROR: relation "Message_id_seq" does not exist
ERROR: permission denied to create "pg_catalog.sessions_users"
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \.
ERROR: syntax error at or near "2"
LINE 1: 2 hello 3 1 2015-11-12 09:25:14.646-07 2015-11-12 09:25:14.64...
ERROR: syntax error at or near "1"
LINE 1: 1
^
ERROR: relation "external_session_info_sessions" does not exist
invalid command \.
ERROR: syntax error at or near "2528"
LINE 1: 2528 1
^
invalid command \.
ERROR: relation "feedback_id_seq" does not exist
LINE 1: SELECT pg_catalog.setval('feedback_id_seq', 1, false);
,SQL文件长相有效。我检查了从9.4.5
到9.6.1
的兼容性问题,但没有看到任何问题。
我确实看到PERMISSION DENIED
但我运行命令为具有超级用户权限的用户postgres
: