我有以下创建的表,我也想对它进行分区,但是MySQL给我以下错误
错误代码:1503。主键必须包括表分区功能中的所有列
CREATE TABLE stock (
stock_id INT NOT NULL AUTO_INCREMENT,
cantidad INT NOT NULL DEFAULT 0,
cantidad_min_aceptable INT NOT NULL DEFAULT 0,
producto_fk INT NOT NULL,
sucursal_fk INT NOT NULL,
PRIMARY KEY(stock_id),
UNIQUE KEY stock_id (stock_id, sucursal_fk),
FOREIGN KEY fk_sto_producto (producto_fk)
REFERENCES producto (producto_id),
FOREIGN KEY fk_sto_sucursal (sucursal_fk)
REFERENCES sucursal (sucursal_id)
)
PARTITION BY LIST (sucursal_fk)(
PARTITION stockBC VALUES IN (1),
PARTITION stockNL VALUES IN (2),
PARTITION stockCHI VALUES IN (3)
);