本文主要是介绍PostgreSQL更改表格的owner,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在PostgreSQL数据库中,每个表格table都有一个owner,这个owner拥有修改table里字段的个数、名称、类型等权限。这里以teachdb数据库中student表格的owner设置hello为例,进行说明,将owner:postgres --> hello。
1、创建teachdb数据库
使用Navicat连接PostgreSQL,创建一个名称为teachdb的数据库,如图(1)所示:

2、设置表格的owner
将student表格的owner,由postgres改为hello,命令如下:
## 1)使用postgres登录teachdb
psql -U postgres -d teachdb## 2)查看owner
\d## 3)设置student的owner为hello
alter table student owner to hello;## 4)查看更新后的owner
\d

这篇关于PostgreSQL更改表格的owner的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!