Skip to content
On this page

@anon

PostgreSQL Anonymizer security labels

Postgres

Example

Mask personally identifiable information

Adds PostgreSQL Anonymizer security labels to sensitive columns.

Input SQL
sql
-- @anon
CREATE TABLE patients (
  id SERIAL PRIMARY KEY,
  -- @anon.mask('anon.partial(email, 2, $$***$$, 2)')
  email TEXT NOT NULL,
  -- @anon.fake('anon.fake_last_name()')
  last_name TEXT NOT NULL
);
Compiled Output
sql
SECURITY LABEL FOR anon ON COLUMN "patients"."email" IS 'MASKED WITH FUNCTION anon.partial(email, 2, $$***$$, 2)';
SECURITY LABEL FOR anon ON COLUMN "patients"."last_name" IS 'MASKED WITH FUNCTION anon.fake_last_name()';

Tags

@anon.mask

Mask this column using a PostgreSQL Anonymizer function

Targets: column

Arguments:Positional: string

@anon.fake

Generate fake data for this column using a PostgreSQL Anonymizer function

Targets: column

Arguments:Positional: string

@anon

Mark this table as containing anonymizable data

Targets: table

Arguments: No arguments.