Syntax

The syntax to rename a user using the ALTER USER statement in PostgreSQL is:

ALTER USER user_name
RENAME TO new_name;

Parameters or Arguments

user_name
The name of the user to rename in the PostgreSQL database.
new_name
The new name to assign to the user.

Note

  • You can not rename the current session user. If you wish to rename the current session user, you will need to logout and then login as a different user to run the ALTER USER statement.

Example

Let's look at how to rename a user in PostgreSQL using the ALTER USER statement.

For example:

ALTER USER techonthenet
RENAME TO totn;

In this example, the ALTER USER statement would rename the user called techonthenet to totn in the PostgreSQL database.

PostgreSQL: Rename a User的更多相关文章

  1. SQL基础篇(MICK)

    SQL基础教程(Mick) 数据库和SQL C:\PostgreSQL\9.5\bin\psql.exe -U postgres -d shop 数据库的基本概念 数据库(DB):将大量数据保存起来, ...

  2. PostgreSQL

    PostgreSQL新手入门   作者: 阮一峰 日期: 2013年12月22日 自从MySQL被Oracle收购以后,PostgreSQL逐渐成为开源关系型数据库的首选. 本文介绍PostgreSQ ...

  3. postgresql 常用数据库命令

    连接数据库, 默认的用户和数据库是postgrespsql -U user -d dbname 切换数据库,相当于MySQL的use dbname\c dbname列举数据库,相当于mysql的sho ...

  4. Ubuntu PostgreSQL安装和配置

    一.安装 1.安装 使用如下命令,会自动安装最新版,这里为9.5 sudo apt-get install postgresql 安装完成后,默认会: (1)创建名为"postgres&qu ...

  5. PostgreSQL简单介绍

    自从MySQL被Oracle收购以后,PostgreSQL逐渐成为开源关系型数据库的首选. 本文介绍PostgreSQL的安装和基本用法,供初次使用者上手.以下内容基于Debian操作系统,其他操作系 ...

  6. PostgreSQL新手入门

    自从MySQL被Oracle收购以后,PostgreSQL逐渐成为开源关系型数据库的首选. 本文介绍PostgreSQL的安装和基本用法,供初次使用者上手.以下内容基于Debian操作系统,其他操作系 ...

  7. PostgreSQL数据库基本配置

    一.安装 首先安装PostgreSQL客户端: sudo apt-get install postgresql-client 然后,安装PostgreSQL服务器: sudo apt-get inst ...

  8. 常用SQL操作(MySQL或PostgreSQL)与相关数据库概念

    本文对常用数据库操作及相关基本概念进行总结:MySQL和PostgreSQL对SQL的支持有所不同,大部分SQL操作还是一样的. 选择要用的数据库(MySQL):use database_name; ...

  9. PostgreSql安装

    官网:http://www.postgresql.org/download/linux/redhat/ 一.安装 由于我的机子是centos6.2,所以选择RedHat的. 按照官网所说的进行安装: ...

随机推荐

  1. Ubuntu安装KScope

    命令安装 # apt-get install kscope 1. 编译安装 # tar xvf kscope-1.9.4.tar.gz # cd kscope-1.9.4 # qmake # make ...

  2. mongdb插入 查询时间

    Robo 3T mongdb客户端 https://www.robomongo.org/ 模糊查找关键字 db.getCollection('test').find({"name" ...

  3. Mac 下 安装Python3

    因为Mac系统自带Python2.7 所以我们开发要重新装Python3 直接运行下面就好 luohaotiandeMacBook-Pro:~ luohaotian$ which python /us ...

  4. git 分支查看与切换

    git 分支查看与切换 # 1.查看所有分支 > git branch -a # 2.查看当前使用分支(结果列表中前面标*号的表示当前使用分支) > git branch # 3.切换分支 ...

  5. 01-HTML基本介绍

    本篇主要介绍HTML相关标签的使用,以及其常用标签的作用等介绍. 一.HTML的介绍 HTML是 HyperText Mark-up Language 的首字母简写,意思是超文本标记语言,超文本指的是 ...

  6. Java--8--新特性--接口中的变化!!

    package InterfaceP; public interface Interface1 { default String getName(){ return "Interface1& ...

  7. 【HICP Gauss】数据库 数据库高级语法(数据类型函数)-3

    SQL高级语法:整型:   integer 2(-31) ~2(31)-1 4字节 intger unsigned 2(0)~2(32)-1 4字节 bigint 2(-63)~2(63)-1 8字节 ...

  8. 数据库系统load飙高问题解决思路

    工作过程中有时候会接收到数据库服务器器load 飙高的报警,比如:  load1 15.25 base: 8.52,collect time:2014-08-30 如何处理load 异常飙高的报警呢? ...

  9. JVM中对象是否已死

  10. Spring源码窥探之:Condition

    采用注解的方式来注入bean 1. 编写config类 /** * @author 70KG * @Title: ConditionConfig * @Description: * @date 201 ...