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.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
value | STRING | "[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]Example — per-type constants
Section titled “Example — per-type constants”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]When to use
Section titled “When to use”- 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.
Limitations
Section titled “Limitations”constantdoes not preserve entity type unless you configure different values per entity type.constantdoes not preserve relationships between repeated values. Usetype_numberedorhashwhen downstream users need to group repeated entities.- Like every operator,
constantonly replaces entities that are detected in the input.
See also
Section titled “See also”- type_numbered — typed, indexed placeholders.
- mask — partial character masking.