You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`pg_diffix` is a PostgreSQL extension for strong dynamic anonymization. It ensures that answers to simple SQL queries are anonymous. For more information, visit the [Open Diffix](https://www.open-diffix.org/) website.
10
4
11
-
Check out the [Admin Tutorial](docs/admin_tutorial.md) for an example on how to set up `pg_diffix`.
12
-
See the [Admin Guide](docs/admin_guide.md) for details on configuring and using the extension.
5
+
**For administrators:** Check out the [admin tutorial](docs/admin_tutorial.md) for an example on how to set up `pg_diffix`.
6
+
See the [admin guide](docs/admin_guide.md) for details on configuring and using the extension.
7
+
To install from source, see the [installation](#installation) section.
8
+
9
+
**For analysts:** The [banking notebook](docs/banking.ipynb) provides example queries against a real dataset.
10
+
The [analyst guide](docs/analyst_guide.md) describes the SQL features and limitations imposed by `pg_diffix`.
13
11
14
12
## Installation
15
13
@@ -34,7 +32,9 @@ every session start for restricted users. This can be accomplished by configurin
34
32
For example, to automatically load the `pg_diffix` extension for all users connecting to a database,
35
33
you can execute the following command:
36
34
37
-
`ALTER DATABASE db_name SET session_preload_libraries TO 'pg_diffix';`
35
+
```
36
+
ALTER DATABASE db_name SET session_preload_libraries TO 'pg_diffix';
37
+
```
38
38
39
39
Once loaded, the extension logs information to `/var/log/postgresql/postgresql-13-main.log` or equivalent.
40
40
@@ -48,7 +48,9 @@ You might also need to remove the extension from the list of preloaded libraries
48
48
49
49
For example, to reset the list of preloaded libraries for a database, you can execute the following command:
50
50
51
-
`ALTER DATABASE db_name SET session_preload_libraries TO DEFAULT;`
51
+
```
52
+
ALTER DATABASE db_name SET session_preload_libraries TO DEFAULT;
53
+
```
52
54
53
55
## Testing the extension
54
56
@@ -67,7 +69,10 @@ or if available, just make your usual PostgreSQL user a `SUPERUSER`.
67
69
68
70
Or you can use the [PGXN Extension Build and Test Tools](https://github.com/pgxn/docker-pgxn-tools) Docker image:
labels the table `transactions` as personal, and labels the `sender_acct` and `receiver_acct` columns as AID columns.
@@ -158,17 +152,7 @@ Default value is `*`. Any user can change this setting.
158
152
159
153
## Restricted features and extensions
160
154
161
-
**TODO:** I think this kind of information is better put in the notebook tutorial? Or if you want it here it seems incomplete or something. Needs work...
162
-
163
-
For users other than `direct`, various data and features built into PostgreSQL are restricted. Among others:
164
-
165
-
1. Issue utility statements like `COPY` and `ALTER TABLE`, beside a few allowlisted ones, are not allowed.
166
-
2. Some of the data in `pg_catalog` tables like `pg_user_functions` is not accessible.
167
-
3. Selected subset of less frequently used PostgreSQL query features like `EXISTS` or `NULLIF` are disabled.
168
-
4. Inheritance involving a personal table is not allowed.
169
-
5. Some of the output of `EXPLAIN` for queries involving a personal table is censored.
170
-
171
-
**NOTE** If any of the currently blocked features is necessary for your use case, open an issue and let us know.
155
+
For a detailed description of supported SQL features and restrictions, see the [analyst guide](analyst_guide.md).
172
156
173
157
Row level security (RLS) can be enabled and used on personal tables.
174
158
It is advised that the active policies are vetted from the point of view of anonymity.
@@ -192,7 +176,7 @@ Given that AIDs may not be perfect, some care must be taken in the selection of
192
176
193
177
For example, imagine the following query in a table where `account_number` is the AID column:
0 commit comments