How To Create Access Select Table Data With Query GRANT On Postgresql




[postgres@prod-odgpostgres ~]$ psql
psql (9.6.3)
Type "help" for help.

postgres=#select 'GRANT SELECT ON '|| table_name ||' TO agungdevelop;' from information_schema.tables where table_schema='public';

If haven't user softdept or misdept you must be create new user agungdevelop or agunganalis, in here you can be follow command:

[postgres@prod-odgpostgres ~]$ psql
psql (9.6.3)
Type "help" for help.

postgres=#CREATE USER agungdevelop WITH PASSWORD 'agungdevelop123';
postgres=#CREATE USER agunganalis WITH PASSWORD 'agunganalis123';

------------------------------------------------------------------------------------------------------------
[postgres@prod-odgpostgres ~]$ psql
psql (9.6.3)
Type "help" for help.

postgres=#select 'GRANT SELECT ON '|| table_name ||' TO agungdevelop;' from information_schema.tables where table_schema='public';

postgres=#grant select on all tables in schema public to agungdevelop;
postgres=#grant select,usage on all sequences in schema public to agungdevelop;

postgres=#GRANT SELECT ON public.transaksi_marmer_detail TO agungdevelop;
postgres=#GRANT SELECT ON public.transaksi_marmer TO agungdevelop;

------------------------------------------------------------------------------------------------------------
[postgres@prod-odgpostgres ~]$ psql
psql (9.6.3)
Type "help" for help.

postgres=#select 'GRANT SELECT ON '|| table_name ||' TO agunganalis;' from information_schema.tables where table_schema='public';

postgres=#grant select on all tables in schema public to agunganalis;
postgres=#grant select,usage on all sequences in schema public to agunganalis;

postgres=#GRANT SELECT ON public.transaksi_marmer_detail TO agunganalis;
postgres=#GRANT SELECT ON public.transaksi_marmer TO agunganalis;

postgres=#GRANT INSERT ON ALL TABLES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT UPDATE ON ALL TABLES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT DELETE ON ALL TABLES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO "agungdevelop";
postgres=#GRANT USAGE ON SCHEMA public to "agungdevelop";

postgres=#grant create ON SCHEMA public TO "agungdevelop";

Comments