当前位置:网站首页>Similarities and differences between the defined identity execution function authid determiner and PostgreSQL in Oracle
Similarities and differences between the defined identity execution function authid determiner and PostgreSQL in Oracle
2022-07-01 23:28:00 【mingjie73】
Oracle Behavior
Oracle The function in can define the execution function body , Which user's permissions are used :
[AUTHID { CURRENT_USER|DEFINER}]
CURRENT_USER The function body has been executed as the current user
DEFINER The identity of the defined person executes the function body
CASE1: For example, the following function will use the current user to execute the function body , If the current user is on tbl1 Read permission can be successfully executed .
CREATE OR REPLACE PROCEDURE TEST_P AUTHID CURRENT_USER IS
BEGIN
EXECUTE IMMEDIATE 'select * from tbl1';
END TEST_P;
CASE2: The following function will use the user who defines the function to execute the function body , If the user who defines the function is right tbl1 Read permission can be successfully executed .
CREATE OR REPLACE PROCEDURE TEST_P AUTHID DEFINER IS
BEGIN
EXECUTE IMMEDIATE 'select * from tbl1';
END TEST_P;
PG Behavior
PG The execution function in is always executed with the permission of the current user , similar Oracle in AUTHID CURRENT_USER
The concept of .
for example user1 Create table
drop table u1tbl;
create table u1tbl(i int);
insert into u1tbl values (123);
user2 Query without permission
postgres=> select * from u1tbl;
ERROR: permission denied for table u1tbl
user1 Create a function
drop function f1();
CREATE OR REPLACE FUNCTION f1() RETURNS int AS $$
DECLARE
id int;
BEGIN
select i into id from u1tbl;
return id;
END;
$$ LANGUAGE plpgsql;
user2 Execute function
postgres=> select f1();
ERROR: permission denied for table u1tbl
CONTEXT: SQL statement "select i from u1tbl"
PL/pgSQL function f1() line 5 at SQL statement
so PG There is no such way to implement the defined identity .
边栏推荐
- 共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
- Wechat personal small store one click opening assistant applet development
- 有没有一段代码,让你为人类的智慧所折服
- [understanding of opportunity-35]: Guiguzi - flying clamp - the art of remote connection, remote control and remote testing
- [LeetCode] 最后一个单词的长度【58】
- Stm32f030f4 drives tim1637 nixie tube chip
- 2022 crane driver (limited to bridge crane) examination questions and simulation examination
- 2022年危险化学品经营单位安全管理人员考试题及在线模拟考试
- Anomaly-Transformer (ICLR 2022 Spotlight)复现过程及问题
- dat. GUI
猜你喜欢
Zero foundation tutorial of Internet of things development
The online beggar function of Japanese shopping websites
[must] bm41 output the right view of the binary tree [medium +]
物联网技术应用属于什么专业分类
2021 RoboCom 世界机器人开发者大赛-高职组复赛
What category does the Internet of things application technology major belong to
Redis AOF日志
2022年危险化学品经营单位安全管理人员考试题及在线模拟考试
mysql binlog的清理
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
随机推荐
What is the mosaic tailgate?
Matplotlib common settings
Commemorate becoming the first dayus200 tripartite demo contributor
Win 10 mstsc connect RemoteApp
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
2021 RoboCom 世界机器人开发者大赛-高职组复赛
Practical application and extension of plain framework
Know --matplotlib
距离度量 —— 汉明距离(Hamming Distance)
Stm32f030f4 drives tim1637 nixie tube chip
什么是马赛克?
typescript枚举
Redis数据类型和应用场景
Linux foundation - centos7 offline installation of MySQL
Typescript enumeration
字典、哈希表、数组的概念
The third part of the construction of the defense system of offensive and defensive exercises is the establishment of a practical security system
建模和影视后期有什么关联?
Notes on problems - /usr/bin/perl is needed by mysql-server-5.1.73-1 glibc23.x86_ sixty-four
Redis RDB快照