Skip to content

Keeping NULL values

Currently a masking rule like this

SECURITY LABEL FOR anon ON COLUMN people.surname IS 
'MASKED WITH FUNCTION anon.dummy_last_name()

would output a value for all tuples, and remove all NULL values.

The work around IF to write a function with a conditionnal

IF foo IS NOT NULL THEN anon.xxx() ELSE NULL

But with many masking it is cumbersome

2 propositions :

  • Add a new function anon.NULLOR ( kind of a strict NULLIF ? )

    • anon.nullor(anon.dummy_first_name(), 'damien') => 'Brian'
    • anon.nullor(anon.dummy_first_name(), NULL) => NULL
  • Add a function anon.NULLRATIO that would insert NULL value in the output

    • anon.nullratio(anon.dummy_first_name(), 0.2 ) would generate 20% of NULL values

And write a warning paragraph in the doc to explain why it is a bad idea 😆

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information