Skip to main content

Rule Set Feature: Logical Key (KBA4451)




KBA# 4451

At a Glance 

Description: In-Place masking needs a Unique Row Identifier (here called Unique Key) and sometimes this needs to be manually defined. 

This is done using a Logical Key.
Versions: Applicable Delphix Masking versions: 4.x, 5.x, 6.x.
Location: UI: Rule Set > Edit Table Settings > Logical Key
API: tableMetadata
Configuration: The following parameter is used to configure this feature: 
  • Logical Key: Key or composite keys separated by a comma. 
Oracle:  From and above we automated the use of ROWID for Oracle. 

There is no need to set the Logical Key to ROWID.
If Custom SQL is used it needs to contain the ROWID

For earlier versions, use ROWID.

UI Code: The code in the Rule Set (UI): 'LK'.
More Info: For information about investigating errors and the logs:
More info: 

Applicable Delphix Versions

Click here to view the versions of the Delphix engine to which this article applies
Major Release All Sub Releases






4.2,,,,,,, ,,


Unique Key

In-Place masking requires a Unique Key in order to update the masked row. 

The masking job will define the Unique Key for Update according to:

  1. Use Logical Key (LK) if specified. 
  2. If no LK, then use the Primary Key (PK) (or ROWID for Oracle).
  3. If no PK, then use the IDENTITY (ID) column.
  4. If no ID, then create MASKING_GENERATED_IDENTITY_TMP (for SQL Server, Sybase, and PostgreSQL). 

Logical Key 

At times it is required to manually set this Unique Key or to define a key other than the Primary Key. This can be if the Primary Key is Masked or there is no Primary Key but there is a set of columns where the values are unique for each row.

Another use case is if the database has a unique pseudo column that can be used as a key - for example Oracle's ROWID, DB2s ROWID, Postgres' CTID to name a few.

Special notes: 

  • The Logical Key needs to be indexed or performance will suffer.
  • Oracle: Delphix has automated the use of this pseudo column on all In-Place jobs. No need to define ROWID as Logical Key.
  • DB2: Check with the DBA if ROWID is enabled on the table.
  • Heap tables: If there is a Unique Key, specify this. 
  • Multiple columns: specify all columns needed, separated by a comma.





To avoid unexpected results:

  • Do not mask the Logical Key. It can cause incorrect results, duplicated entries, or job failure. 
  • Columns in the Logical Key should be indexed (or masking performance will be slow). 
  • Do not drop (manually or using Pre-Scripts) the Index on the Logical Key.


UI Overview

The examples below show the Rule Set page and the Edit Rule Set popup. 

Rule Set page

Please note the 'LK' indicator when the table has a Logical Key defined. 


Edit Table Settings popup

The example shows a single Unique Key (MY_ID). For multiple columns, separate each key with a comma. 


Error Message

Version 6.0.11 introduced a validation of the columns added as the Logical Key to ensure they are valid.  This was further improved in 6.0.16 which now also allows pseudo columns. This release also improved the error message.

Invalid column

If an invalid column (or columns) is added as a Logical Key, the following error is shown in the UI (popup):

Error message: "Invalid Logical Key. Specified column(s) don't exist in the table."





The message on 6.0.11 was:
Table: 'x' column(s): 'xyz' contains one or more columns that don't exist in the table. Specify column(s) that exist in the table [...]


Older versions

No valid input errors

The Logical Key is not verified when entered. It is assumed that this key is valid and that it can be used in the Masking Job. 

Tables missing from ruleset 

This can happen if you have a new line/carriage return in the field.  Newer versions strip out the new line/carriage return characters from the input to avoid this, but older versions are still susceptible.  If encountered, this requires a support interaction to resolve.

Errors Message Logs

If an invalid column is added as a Logical Key, the following error is thrown in the logs: 


YYYY-MM-DDTHH:MM:SS:sssZ ... ERROR c.dmsuite.dataPlatform.DataPlatform - Encountered exception while attempting to execute the following query: 'SELECT 1 FROM "DBO"."TBL" WHERE "XYZ" IS NULL'
5535:java.sql.SQLSyntaxErrorException: ORA-00904: "XYZ": invalid identifier


YYYY-MM-DDTHH:MM:SS:sssZ ... ERROR c.dmsuite.manager.CollectionManager - Error while updating logical key
com.dmsuite.exception.BadRequestException: Table: 'TBL' column(s): 'XYZ' contains one or more columns that don't exist in the table. Specify column(s) that exist in the table: [...]
        at com.dmsuite.manager.CollectionManager.validateLogicalKeyColumnsForTable(