当前位置:网站首页>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 .
边栏推荐
- Openresty load balancing
- 【必会】BM41 输出二叉树的右视图【中等+】
- 2022 crane driver (limited to bridge crane) examination questions and simulation examination
- Create Ca and issue certificate through go language
- MySQL -- convert rownum in Oracle to MySQL
- Matplotlib常用图表
- 【微服务|Sentinel】SentinelResourceAspect详解
- 2022年最佳智能家居开源系统:Alexa、Home Assistant、HomeKit生态系统介绍
- Daily three questions 6.28
- flutter Unable to load asset: assets/images/888. png
猜你喜欢
随机推荐
CKS CKA ckad change terminal to remote desktop
[swoole Series 1] what will you learn in the world of swoole?
Redis 主从同步
The online beggar function of Japanese shopping websites
Switch to software testing, knowing these four points is enough!
Win 10 mstsc connect RemoteApp
Material Design组件 - 使用BottomSheet展现扩展内容(一)
What is the difference between memory leak and memory overflow?
from pip._internal.cli.main import main ModuleNotFoundError: No module named ‘pip‘
ARP报文头部格式和请求流程
Stm32f030f4 drives tim1637 nixie tube chip
[understanding of opportunity-35]: Guiguzi - flying clamp - the art of remote connection, remote control and remote testing
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
SWT / anr problem - SWT causes low memory killer (LMK)
The digital summit is popular, and city chain technology has triggered a new round of business transformation
Which securities company is better and which is safer to open a securities account
Matplotlib常用图表
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
物联网现状及未来发展趋势
Linux foundation - centos7 offline installation of MySQL









