aboutsummaryrefslogtreecommitdiff
path: root/content/blog/miscellaneous/postgresql-read-only.md
blob: c064e970fe91f86fe327cb0659b1f2c84b44cca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
title: "Grant postgresql read only access"
linkTitle: "Grant postgresql read only access"
date: 2015-11-24
description: >
  Grant postgresql read only access
---

{{< highlight sh >}}
GRANT CONNECT ON DATABASE "db" TO "user";
\c db
GRANT USAGE ON SCHEMA public TO "user";
GRANT SELECT ON ALL TABLES IN SCHEMA public TO "user";
ALTER DEFAULT PRIVILEGES IN SCHEMA public
   GRANT SELECT ON TABLES TO "user";
{{< /highlight >}}