Skip to main content

Primary key constrain

  • March 19, 2014
  • 1 reply
  • 5 views

Martin_2
Forum|alt.badge.img+1
I have a dimension table, I need a unique constrain on the table's primary key. But I find the constrain seems don't make sense in Vertica. For example, I inserted a primary key(PK00001) into table. and I insert again (PK00001). I supposed it can't be inserted again, but actually it can.

I am wonder if there is a real PK unique constrain at database level for Vertica, or is there any approaches like PK unique constrain at database level. 

Thanks and Best Regards,
Martin

1 reply

Shobhit_Garg
Forum|alt.badge.img
  • Participating Frequently
  • March 19, 2014
Hi Martin,

In vertica, the constraints can be created, but vertica does not check them during the time of data load. So if you are able to load duplicate data in a table with PK or unique key then its a normal thing.

Constraints are being checked during the time of query execution.
However you can check the constraints voilations the using ANALYZE_CONSTRAINTS() function.
Kindly refer to below vertica documentation link
https://my.vertica.com/docs/6.1.x/HTML/index.htm#14038.htm

Thanks,
Shobhit