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. vscode编辑器中文乱码问题

    设置配置自动格式化: "[javascriptreact]": { "editor.defaultFormatter": "esbenp.pretti ...

  2. shell脚本4种执行方式

    Linux中shell脚本的执行通常有4种方式,分别为工作目录执行,绝对路径执行,sh执行,shell环境执行. 首先,看下我们的脚本内容 [tan@tan scripts]$ ll total -r ...

  3. 编写订单支付api中遇到的问题

    首先我是按照已经有的已经有的支付api去编写订单支付api,但是由于两者是有区别的,所以类似去搬用难免会出问题,首先我是套用已经写好的model,然后写相应的serializer,实现序列化之后就开始 ...

  4. 使用VS.NET2019做为C++开发专用IDE

    一.下载安装包: https://visualstudio.microsoft.com/zh-hans/downloads/ 我下载的是企业版本. 二.安装支持C++ 序列号: Visual Stud ...

  5. ashx 文件的运用

    ASP.NET中有一种这样格式的文件ashx文件,作什么用的呢?如果你想创建一个ASP.NET文件,它不是aspx文件,它能动态的返回一个图片.XML文件或其他非HTML文件.那就使用ashx文件了. ...

  6. abp学习(四)——根据入门教程(aspnetMVC Web API进一步学习)

    Introduction With AspNet MVC Web API EntityFramework and AngularJS 地址:https://aspnetboilerplate.com/ ...

  7. LeetCode - 82、删除排序链表中的重复元素 II

    给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字. 示例 1: 输入: 1->2->3->3->4->4->5    输出: 1 ...

  8. pycharm注册使用

    先在PyCharm官网下载安装包 链接:https://www.jetbrains.com/pycharm/download/#section=linux 选择平台为Linux,可以看到当前版本为20 ...

  9. JS AJAX和JSONP的基础功能封装以及使用示例;

    1.代码: function ajax(options){ options = options || {}; options.type = options.type || "get" ...

  10. 使用socket.io实现多房间通信聊天室

    websocket的实现有很多种,像ws和socket.io,这里使用的是socket.io来实现多房间的效果. 这里的使用没有使用socket.io官方提供的namespace和room,而是完全通 ...