Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在停靠的postgresql中导入数据库_Postgresql_Shell - Fatal编程技术网

在停靠的postgresql中导入数据库

在停靠的postgresql中导入数据库,postgresql,shell,Postgresql,Shell,我正在尝试使用postgresql:9.6将数据库架构和数据导入docker容器 我成功创建了我的数据库: docker exec <container> psql -U <user> postgres -l Name | Owner | Encoding | Collate | Ctype | Access privileges -------------------+-------------

我正在尝试使用
postgresql:9.6
将数据库架构和数据导入docker容器

我成功创建了我的数据库:

docker exec <container> psql -U <user> postgres -l

       Name        |       Owner        | Encoding |  Collate   |   Ctype    |   Access privileges
-------------------+--------------------+----------+------------+------------+-----------------------
 <database>        | <user>             | UTF8     | en_US.utf8 | en_US.utf8 |
 postgres          | postgres           | UTF8     | en_US.utf8 | en_US.utf8 |
 template0         | postgres           | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                   |                    |          |            |            | postgres=CTc/postgres
 template1         | postgres           | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                   |                    |          |            |            | postgres=CTc/postgres
(4 rows)
docker exec psql-U postgres-l
姓名|所有者|编码|校对| Ctype |访问权限
-------------------+--------------------+----------+------------+------------+-----------------------
|| UTF8 | en|u US.UTF8 | en|u US.UTF8|
博士后|博士后| UTF8 | en|U US.UTF8 | en|U US.UTF8|
模板0 | postgres | UTF8 | en|u US.UTF8 | en|u US.UTF8 |=c/postgres+
|| | | | postgres=CTc/postgres
模板1 | postgres | UTF8 | en|u US.UTF8 | en|u US.UTF8 |=c/postgres+
|| | | | postgres=CTc/postgres
(4排)
我正在使用以下命令导入(我也尝试了几种替代方法):

docker exec psql-U-d
它没有导入我的数据库,而是向我显示
herdoc>
提示符

有什么线索吗

我正在运行osx
iterm 2
,并且
zsh
发现了我的问题

我正在使用

docker exec <container> psql -U <user> -d <database> << '<sql dump file>'
heredoc>