Skip to content

constant

constant replaces each detected entity with a fixed string. Use it when the reader does not need to distinguish entity types or repeated values, and a single redaction marker is enough for the workflow.

When configured under DEFAULT, the same value is used for every entity type that does not have its own rule. You can also configure different constants for specific entity types.

ParameterTypeDefaultDescription
valueSTRING"[REDACTED]"The fixed string used for every replacement.

Example — same replacement for every entity

Section titled “Example — same replacement for every entity”
SELECT app_public.mask(
'John Smith called from 555-0100',
OBJECT_CONSTRUCT(
'entity_config', OBJECT_CONSTRUCT(
'DEFAULT', OBJECT_CONSTRUCT(
'operator', 'constant',
'operator_params', OBJECT_CONSTRUCT('value', '[REDACTED]')
)
)
)
);

Output:

[REDACTED] called from [REDACTED]

Use different constants for different entity types:

SELECT app_public.mask(
'Jane Smith prescribed Metformin. Contact: jane@acme.com',
OBJECT_CONSTRUCT(
'entity_config', OBJECT_CONSTRUCT(
'PERSON', OBJECT_CONSTRUCT(
'operator', 'constant',
'operator_params', OBJECT_CONSTRUCT('value', '[PATIENT]')
),
'EMAIL_ADDRESS', OBJECT_CONSTRUCT(
'operator', 'constant',
'operator_params', OBJECT_CONSTRUCT('value', '[EMAIL]')
)
)
)
);

Output:

[PATIENT] prescribed Metformin. Contact: [EMAIL]
  • You want a uniform redaction marker such as [REDACTED].
  • Output will be reviewed by humans who do not need to tell entities apart.
  • Downstream processing does not need entity grouping, counts, or joins.
  • You want per-type labels such as [PATIENT] and [EMAIL] without counters.
  • constant does not preserve entity type unless you configure different values per entity type.
  • constant does not preserve relationships between repeated values. Use type_numbered or hash when downstream users need to group repeated entities.
  • Like every operator, constant only replaces entities that are detected in the input.