我正在try 运行一个查询,以使用更新用户密码.

alter user dell-sys with password 'Pass@133';

但是因为-,它给了我这样的错误,

ERROR:  syntax error at or near "-"
LINE 1: alter user dell-sys with password 'Pass@133';
                       ^

有人能给它遮光吗?

推荐答案

我已经在我的系统中复制了这个问题,

postgres=# alter user my-sys with password 'pass11';
ERROR:  syntax error at or near "-"
LINE 1: alter user my-sys with password 'pass11';
                       ^

问题是,

psql请求输入,您再次给出了alter查询,这就是为什么它在alter中给出错误

postgres-# alter user "my-sys" with password 'pass11';
ERROR:  syntax error at or near "alter"
LINE 2: alter user "my-sys" with password 'pass11';
        ^

解决方法和错误一样简单,

postgres=# alter user "my-sys" with password 'pass11';
ALTER ROLE

Postgresql相关问答推荐

当通过PostgreSQL FDW中的视图使用时,年龄函数的计算方式不同

无法从Docker迁移Golang上的两个不同服务到一个数据库'

使用Spring data jpa和CriteriaQuery在jsonb列中搜索操作

如何在PostgreSQL中 Select 最近30天内的开始日期?

右连接 postgresql 出现语法错误

连接到 PostgreSQL 时没有属性执行错误

postgres 如何计算多列哈希?

用于生产的 Rails 性能调优?

postgresql查询中的正则表达式不区分大小写

Postgres COPY FROM csv file-No such file or directory

Docker Compose + Spring Boot + Postgres 连接

PostgreSQL CASE 在函数中的使用

在 PL/pgSQL 中声明行类型变量

适配器 Ecto.Adapters.Postgres 未编译

使用 PostgreSQL 创建数据透视表

如何将表的一列复制到PostgreSQL中比较相同ID的另一表的列

将数据推送到 Heroku 时出错:time zone displacement out of range

PostgreSQL:如何在用户级别设置 search_path?

PostgreSQL:从转储中恢复数据库 - 语法错误

使用 Homebrew 安装 icu4c 版本 63