All Forums Database
Moutusi 38 posts Joined 03/13
03 Sep 2014
Creating table with defined PK but not defining PI

I have created below table:
create table T1
col1 varchar (20)
,col2 int
,col3 varchar (10)
, primary key (col1, col2));
After creating this table while executing show select * from T1 I found no PI has been choosen by Teradata.
Will teradata treat this table as NOPI?
If remove the PK from table create staement it is automatically selecting col1 as PI. If I define both PI and PK on col1 and col2 it is throwing error.

Thanks, Moutusi
dnoeth 4628 posts Joined 11/04
03 Sep 2014

Hi Moutusi,
A few years ago the result of a SHOW TABLE was changed to return the logical constraints instead of the internally created indexes.
So you still get a UPI on (col1,col2), but you have to figure it out yourself - I never liked the new output :(
When you query dbc.IndicesV you'll see a IndexNumber 1 for it, indicating it's the PI.


You must sign in to leave a comment.