Data
SQL Statements
Creating a user
Create a user a give access to tablename
CREATE USER app_user WITH PASSWORD 'password';
GRANT SELECT, INSERT, UPDATE, DELETE ON tablename TO app_user;
GRANT USAGE, SELECT ON SEQUENCE tablename_id_seq TO app_user;
GRANT UPDATE ON SEQUENCE tablename_id_seq TO app_user;Find all Users and there rights/roles
SELECT u.usename AS "Role name",
CASE WHEN u.usesuper AND u.usecreatedb THEN CAST('superuser, create
database' AS pg_catalog.text)
WHEN u.usesuper THEN CAST('superuser' AS pg_catalog.text)
WHEN u.usecreatedb THEN CAST('create database' AS
pg_catalog.text)
ELSE CAST('' AS pg_catalog.text)
END AS "Attributes"
FROM pg_catalog.pg_user u
ORDER BY 1;access right
Insert Data
create Table
Insert into table (no space between table name and columns)
create new table and user for that table
Add column to table
add column deletedBefore with timezone aware timestamp
Verify changes where made
Last updated