RDS PostgreSQL无法删除用户名包含特殊字符的用户

0

【以下的问题经过翻译处理】 我的数据库中有一些带有特殊字符的用户无法删除,有什么办法可以解决吗?

dwh_sch=# select * from pg_user where usename like 'jenn%' ;
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd | valuntil | useconfig
--------------------------------------------------------------------------------+-----------
jenni.tulamito | 125 | f | f | f | ******** | |
(1 row)

dwh_sch=# drop user jenni.tulamito ;
ERROR: syntax error at or near "."
LINE 1: drop user jenni.tulamito ;
profile picture
ESPECIALISTA
feita há 6 meses8 visualizações
1 Resposta
0

【以下的回答经过翻译处理】 将用户名带上双引号即可,示例如下

CREATE USER "test.user" PASSWORD 'Testing123';
-- CREATE USER

select * from pg_user where usename like 'test%';
--   usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil | useconfig
-- -----------+----------+-------------+----------+-----------+----------+----------+-----------
--  test.user |      121 | f           | f        | f         | ******** |          |
DROP USER "test.user";
-- DROP USER
 
select * from pg_user where usename like 'test%';
--  usename | usesysid | usecreatedb | usesuper | usecatupd | passwd | valuntil | useconfig
-- ---------+----------+-------------+----------+-----------+--------+----------+----------- 

profile picture
ESPECIALISTA
respondido há 6 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas