Hi
Can I Name a Primary Key in crateDB?
It doesn’t seem to follow the ANSI SQL standard of…
CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, CONSTRAINT PK_Person PRIMARY KEY (ID,LastName) );
Regards
Mark
Hi @MarkF,
named primary keys are indeed not supported right now. There is an open feature request, you can upvote it to help with prioritizing: Support for named PRIMARY KEY constraints · Issue #11025 · crate/crate · GitHub
In your case, you can still define a composite primary key without naming it, like this:
CREATE TABLE Persons ( ID int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Age int, PRIMARY KEY (ID, LastName) );
OK - thanks for the quick response.