Why a Key defined for a class is different than PK in the PostgreSQL?

Hi,

I see that the Key defined on the Class rule (CustomerID) is different than the PK defined directly in the table (pzinskey). Why is that?

@jedrb

Hi I have tried creating a data class

  1. from App studio, then the primary key was set to either pyGuid OR the key mentioned in the class.

  2. from the Designer studio with database as PegaDATA then pzInskey is the primary key

  3. from Designer studio with database as Customer, then key selected in the class is the primary key

Can you please let me know how your data class was created? And you want to know the reason or have a primary key something different from pzInsKey. If your question on about later then would suggest you try either of the first two methods I have tried.

@siris2 - I’ve already found an answer to my question - please refer to this post: https://support.pega.com/question/what-difference-between-pzinskey-primary-key.

It appears that the pzInsKey is always the PK despite the key in the class configuration points to a different property (different database column).

@jedrb

“It appears that the pzInsKey is always the PK despite the key in the class configuration points to a different property (different database column).” that is not true always .

when you create a class in the below ways pzInsKey is not the primary key.

  1. from App studio, then the primary key was set to either pyGuid OR the key mentioned in the class.

  2. from Designer studio with database as Customer, then the key selected in the class is the primary key