Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view the permissions of the PG database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to view the permissions of the PG database", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to view the permissions of the PG database" this article.

The permissions of pg are stored in several places.

1. User permissions

Login to the instance or ddl permissions to db are placed in the pg_role table.

Pconline= > select * from pg_roles

-[RECORD 1]-+--

Rolname | repl

Rolsuper | f

Rolinherit | t

Rolcreaterole | f

Rolcreatedb | f

Rolcatupdate | f

Rolcanlogin | t

Rolreplication | t

Rolconnlimit |-1

Rolpassword | *

Rolvaliduntil |

Rolconfig |

Oid | 16384

For TABLE, COLUMN, functions, custom functions, and usage permissions, are stored in the table under information_schema.

Information_schema stores permissions for objects under the current db. For example:

Select * from information_schema.role_table_grants where grantee='lsliang'

-[RECORD 2]-+--

Grantor | pc

Grantee | lsliang

Table_catalog | pc

Table_schema | pc

Table_name | temp_20160513

Privilege_type | SELECT

Is_grantable | NO

With_hierarchy | YES

two。 Permissions on object

If you want to see what permissions are on a table.

You can use the command line command:

Pconline= >\ dp temp_20160513

Access privileges

-[RECORD 1]-+--

Schema | pc

Name | temp_20160513

Type | table

Access privileges | pc=arwdDxt/pc

| | pc_reader=r/pc |

| | pgreader_pc=r/pc |

| | u1=r/pc |

| | u2=r/pc |

| | user3=r/pc |

Column access privileges |

The permission field arwdDxt

A = insert

R = select

W = update

D = delete

D = truncate

X = reference

T = trigger

Another is to query the PG_CLASS system view:

Pconline= > select * from pg_class where relname='temp_20160513'

-[RECORD 1]-+- -

Relname | temp_20160513

Relnamespace | 24585

Reltype | 5471707

Reloftype | 0

Relowner | 24577

Relam | 0

Relfilenode | 5491139

Reltablespace | 0

Relpages | 285

Reltuples | 64310

Relallvisible | 285

Reltoastrelid | 0

Reltoastidxid | 0

Relhasindex | f

Relisshared | f

Relpersistence | p

Relkind | r

Relnatts | 1

Relchecks | 0

Relhasoids | f

Relhaspkey | f

Relhasrules | f

Relhastriggers | f

Relhassubclass | f

Relfrozenxid | 1102384891

Relacl | {pc=arwdDxt/pc,pc_reader=r/pc,pgreader_pc=r/pc,u1=r/pc,u2=r/pc,user3=r/pc}

The above is all the contents of the article "how to check the permissions of the PG database". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report