简体   繁体   中英

CrateDB - setting custom column as primary key automatically sets it as “_id” column

Assume I create table users with columns ( firstname, lastname, email, address etc. ). CrateDB automatically adds _id column, whose values are some kind of weird strings. If I set email column as PRIMARY KEY on table creation, then _id column becomes filled with values from email column, ie ID's of records become emails. Is there any way to retain "weird strings" as ID's in _id column and leave email column as PRIMARY KEY?

PS email column must be PRIMARY KEY, as I want to ensure unique emails in that column.

At the moment there is no way to change that. When there is exactly one primary key column the value of the primary column is used. When you have two and more it is base64 encoded.

Why do you need to uuid string?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM