Search
PostgreSQL
Last updated
Feb 18, 2023
# Vacuum
- DB 디스크 조각 모음
- 데이터가
update
/delete
# pg_user
# select all user
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| SELECT
usename AS role_name,
CASE
WHEN usesuper AND usecreatedb
THEN CAST('superuser, create database' AS pg_catalog.text)
WHEN usesuper
THEN CAST('superuser' AS pg_catalog.text)
WHEN usecreatedb
THEN CAST('create database' AS pg_catalog.text)
ELSE
CAST('' AS pg_catalog.text)
END role_attributes
FROM pg_catalog.pg_user
ORDER BY role_name desc;
|
# create user
1
2
3
| CREATE USER <name>;
CREATE USER <name> WITH PASSWORD '<password>';
ALTER USER <name> WITH PASSWORD '<password>';
|
# grant privileges
1
2
| GRANT ALL PRIVILEGES ON DATABASE <database> TO <name>;
SELECT * from information_schema.table_privileges WHERE grantee = '<name>' LIMIT 5;
|
# References