radondb / radon

RadonDB is an open source, cloud-native MySQL database for building global, scalable cloud services
https://radondb.io/
GNU General Public License v3.0
1.79k stars 218 forks source link

[bug] when partition key not same with primary key, radon doesn`t report error #153

Closed hustjieke closed 5 years ago

hustjieke commented 5 years ago

case: create a table and the partition key is a, but primary key is b

mysql> create table test(a int, b char, primary key(b)) partition by hash(a);
Query OK, 0 rows affected (0.42 sec)
BohuTANG commented 5 years ago

Hi,

Here can't return error, I guess your mean is auto_increment?

hustjieke commented 5 years ago

Hi,

Here can't return error, I guess your mean is auto_increment?

To ensure the unique of the primary key(or unique index),I think we should return error like "The unique/primary constraint only be defined on the sharding key column[a] not [b]", just as the code does:

https://github.com/radondb/radon/blob/master/src/proxy/ddl.go#L49

BohuTANG commented 5 years ago

Got, make sense.

On Fri, Nov 30, 2018 at 13:34 hustjieke notifications@github.com wrote:

Hi,

Here can't return error, I guess your mean is auto_increment?

To ensure the unique of the primary key(or unique index),I think we should return error like "The unique/primary constraint only be defined on the sharding key column[a] not [b]", just as the code does:

https://github.com/radondb/radon/blob/master/src/proxy/ddl.go#L49

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/radondb/radon/issues/153#issuecomment-443096667, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKgrPJiKmUHrqcruZyxroR41_w_mzOgks5u0MNzgaJpZM4Y68zZ .

-- BohuTANG

"The great artist is the simplifier."--- Vincent Van Gogh