Postgresql实现不同用跨模式访问
1、修改参数
2、创建两个用户
- 创建a1
create
user a1 connection limit-1 password '123456';
alter user a1 SUPERUSER;
grant create
on
database "test" to "a1" with grant option;
grant temporary on
database "test" to "a1" with grant option;
grant temp on
database "test" to "a1" with grant option;
grant connect on
database "test" to "a1" with grant option;
- 创建a2
create
user a2 connection limit-1 password '123456';
alter user a2 SUPERUSER;
grant create
on
database "test" to "a2" with grant option;
grant temporary on
database "test" to "a2" with grant option;
grant temp on
database "test" to "a2" with grant option;
grant connect on
database "test" to "a2" with grant option;
3、在a1和a2下创建各自模式
create schema a1schema;
create table a1schema.t1(id int);
create schema a2schema;
create table a2schema.t2(id int);
insert into a2schema.t2 values(111111111);
4、a1访问a2下的t2表
- 创建视图
CREATE VIEW "a1".v_t2 AS select id from a2.t2;
- 创建同义词
create synonym t2 for v_t2;
- 访问t2
selet * from t2
最新文章
- 【Java EE 学习 16 上】【dbcp数据库连接池】【c3p0数据库连接池】
- 使用ping钥匙临时开启SSH:22端口,实现远程安全SSH登录管理就这么简单
- C# .net中cookie值为中文时的乱码解决方法
- cocos2dx 3.x(定时器或延时动作自动调用button的点击响应事件)实现自动内测
- java maven诡异的错误no class found
- db2安装及卸载
- oracle sql 语句优化
- 一份完整的nginx配置
- 【重要】ASCII码表
- [C程序设计语言]第二部分
- Android控件之AutoCompleteTextView(自动匹配输入的内容)
- Maven Build Life Cycle--reference
- Latex 去掉行号
- DataTable克隆行
- 高可用集群之keepalived+lvs实战-技术流ken
- 【转】C++标准转换运算符const_cast
- centos7 yum安装ffmpeg,以及ffmpeg的简单用法
- sdn的相关学习系列之一mininet的安装
- ubuntu下tensorflow 报错 libcusolver.so.8.0: cannot open shared object file: No such file or directory
- [C++]QString方法集
热门文章
- 锂电池3.7V转3V,1.5V的稳压和降压芯片
- python中文件操作相关基础知识
- 持续发烧,试试Dart语言的异步操作,效率提升500%
- MSTN CE和MSTN SDK安装经验及技巧
- 关于如何在C#中调用C++的DLL,以及如何在C++中调用C#的DLL
- 时钟同步服务器ntp安装文档
- 如何在 Nuxt 3 中使用 wavesurfer.js
- 动力节点——day07
- 除了Navicat和DBeaver,还有没有免费又好用的数据库管理/SQL工具推荐
- 【学习笔记】开源库之 - sigslot (在解决浅拷贝问题的基础上增加信号拦截功能)