小编and*_*abs的帖子

为什么 pg_restore 忽略 --create ?错误:失败:致命:数据库“new_db”不存在

我正在尝试运行以下命令:

sshpass  -p "pass" ssh  x@1.2.3.4 "pg_dump -Fc -U foo some_db" | pg_restore --create --dbname=new_db
Run Code Online (Sandbox Code Playgroud)

我得到:

failed: FATAL:  database "new_db" does not exist
Run Code Online (Sandbox Code Playgroud)

postgresql psql postgresql-9.3

27
推荐指数
3
解决办法
3万
查看次数

INDEX 中使用的 CONCAT 导致错误:索引表达式中的函数必须标记为 IMMUTABLE

我面临以下错误:

ERROR:  functions in index expression must be marked IMMUTABLE
Run Code Online (Sandbox Code Playgroud)

尝试创建这样的索引时:

CREATE INDEX full_phone_number ON orders_clientphone (concat(area_code, phone));
Run Code Online (Sandbox Code Playgroud)

另一方面,当使用替代语法进行连接时:

CREATE INDEX full_phone_number ON orders_clientphone ((area_code || phone));
Run Code Online (Sandbox Code Playgroud)

Postgres 对此非常满意。
两列都定义为character varying(256)

postgresql index datatypes functions postgresql-9.4

9
推荐指数
1
解决办法
4979
查看次数