我想導入一個.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
: