0

我正在尝试删除用户“theuser”

postgres-# \du
                          List of roles
    Role name  |                   Attributes                   | Member of 
    -------------+------------------------------------------------+-----------
    postgres    | Superuser, Create role, Create DB, Replication | {}
    theuser | Create DB                                      | {}
postgres-# drop user theuser
postgres-# \du
                          List of roles
    Role name  |                   Attributes                   | Member of 
    -------------+------------------------------------------------+-----------
    postgres    | Superuser, Create role, Create DB, Replication | {}
    theuser | Create DB  

不太确定为什么它没有放弃用户?

与创建用户相同

postgres-# create user bob with createdb login
postgres-# \du
                          List of roles
     Role name  |                   Attributes                   | Member of 
     -------------+------------------------------------------------+-----------
     postgres    | Superuser, Create role, Create DB, Replication | {}
     sportstweet | Create DB 
4

1 回答 1

2

您需要用 a 终止语句;,否则 psql 不会“看到”您的语句已完成。

提示从( vs. )postgres=#变为( vs. ) 表示您“在”一个语句中,而不是在“下一个”语句中。我承认有点难看。但是,如果您想要更明显的区别,您可以配置此显示。详情请看手册:http ://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-PROMPTINGpostgres-#=-

(顺便说一句:如果你禁用了自动提交,你也需要提交它!)

于 2013-05-06T21:14:56.787 回答