当前位置:网站首页>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 .
边栏推荐
- 【小程序】通过scroll-view组件实现左右【滑动】列表
- 会声会影2022智能、快速、简单的视频剪辑软件
- flutter Unable to load asset: assets/images/888.png
- 2021 RoboCom 世界机器人开发者大赛-高职组初赛
- 建模和影视后期有什么关联?
- Postgresql源码(58)元组拼接heap_form_tuple剖析
- flutter Unable to load asset: assets/images/888. png
- plain framework的实际应用和扩展
- Practical application and extension of plain framework
- SWT/ANR问题--SWT 导致 kernel fuse deadlock
猜你喜欢

Development trend and future direction of neural network Internet of things

Redis RDB快照

CADD课程学习(3)-- 靶点药物相互作用

物联网现状及未来发展趋势

Experience of practical learning of Silicon Valley products

CADD course learning (3) -- target drug interaction

2022年R1快开门式压力容器操作考题及答案

Win 10 mstsc connect RemoteApp

Linux foundation - centos7 offline installation of MySQL

Aaai22 | structural tagging and interaction modeling: a "slim" network for graph classification
随机推荐
Linux基础 —— CentOS7 离线安装 MySQL
Matplotlib common charts
Postgresql源码(58)元组拼接heap_form_tuple剖析
想请教股票开户要认识谁?在线开户是安全么?
from pip._ internal. cli. main import main ModuleNotFoundError: No module named ‘pip‘
Experience of practical learning of Silicon Valley products
Jielizhi Bluetooth headset quality control and production skills [chapter]
y53.第三章 Kubernetes从入门到精通 -- ingress(二六)
Aaai22 | structural tagging and interaction modeling: a "slim" network for graph classification
The difference between timer and scheduledthreadpoolexecutor
Current situation and future development trend of Internet of things
Distance measurement - Hamming distance
2022 crane driver (limited to bridge crane) examination questions and simulation examination
typescript枚举
Daily three questions 6.30
What is the difference between memory leak and memory overflow?
MySQL -- convert rownum in Oracle to MySQL
CKS CKA ckad change terminal to remote desktop
物联网现状及未来发展趋势
Some thoughts on game performance optimization