Sai Reddy

Sai Reddy

  • NA
  • 214
  • 31.6k

Table partitioning -> primary key error

Sep 26 2018 4:40 AM
 Hi,
 While creating partition on a table , the following error occured. How to resolve it?
A PRIMARY KEY must include all columns in the table's partitioning function
 
CREATE TABLE article_part (
article_id int(11) NOT NULL AUTO_INCREMENT,
article_title text,
source_edition_id bigint(15) DEFAULT NULL,
paper_page_no int(10) DEFAULT NULL,
co_ordinates varchar(500) DEFAULT NULL,
image_url varchar(2000) DEFAULT NULL,
user_id bigint(15) DEFAULT NULL,
category_id bigint(15) DEFAULT NULL,
author varchar(150) DEFAULT NULL,
article_inserted_time datetime DEFAULT NULL,
feedback varchar(20) DEFAULT NULL,
editions_downloaded_id bigint(15) DEFAULT NULL,
description text,
is_deleted enum('Y','N') DEFAULT NULL,
reason_article bigint(15) DEFAULT NULL,
article_truth bigint(15) DEFAULT NULL,
parent_article_id bigint(15) DEFAULT NULL,
is_linked enum('Y','N') DEFAULT 'N',
is_grouped enum('Y','N') DEFAULT 'N',
is_important enum('Y','N') DEFAULT 'N',
involved varchar(10) DEFAULT NULL,
is_uploaded enum('Y','N') DEFAULT 'N',
source_url varchar(500) DEFAULT NULL,
from_source varchar(500) DEFAULT NULL,
actionable enum('Y','N') DEFAULT 'N',
news_bulletin enum('Y','N') DEFAULT 'N',
news_organization int(11) DEFAULT NULL,
article_size bigint(15) DEFAULT NULL,
article_perc float DEFAULT '0',
article_created_time datetime DEFAULT NULL,
is_old_article enum('Y','N') DEFAULT 'N',
is_counter_attack enum('Y','N') DEFAULT 'N',
counter_attack_news_organization int(11) DEFAULT NULL, PRIMARY KEY (article_id))
ENGINE=InnoDB AUTO_INCREMENT=286802795 DEFAULT CHARSET=utf8
PARTITION BY RANGE( TO_DAYS(article_inserted_time) ) (
PARTITION p20110401 VALUES LESS THAN (TO_DAYS('2011-04-02')),
PARTITION p20110402 VALUES LESS THAN (TO_DAYS('2011-04-03')),
PARTITION p20110403 VALUES LESS THAN (TO_DAYS('2011-04-04')),
PARTITION p20110404 VALUES LESS THAN (TO_DAYS('2011-04-05')),
PARTITION p20110426 VALUES LESS THAN (TO_DAYS('2011-04-27')),
PARTITION p20110427 VALUES LESS THAN (TO_DAYS('2011-04-28')),
PARTITION p20110428 VALUES LESS THAN (TO_DAYS('2011-04-29')),
PARTITION p20110429 VALUES LESS THAN (TO_DAYS('2011-04-30')),
PARTITION future VALUES LESS THAN MAXVALUE

Answers (1)