Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Oracle] Partition Key column not part of Primary Key columns #578

Open
sanyamsinghal opened this issue Nov 10, 2022 · 0 comments
Open

[Oracle] Partition Key column not part of Primary Key columns #578

sanyamsinghal opened this issue Nov 10, 2022 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@sanyamsinghal
Copy link
Collaborator

sanyamsinghal commented Nov 10, 2022

In YugabyteDB, If the table is partitioned on a column then that column needs to be a part of the PRIMARY KEY columns.

For example, Exported Schema:

CREATE TABLE employees (
employee_id integer NOT NULL,
first_name varchar(20),
last_name varchar(25),
email varchar(25),
phone_number varchar(20),
hire_date timestamp DEFAULT statement_timestamp(),
job_id varchar(10),
salary double precision,
part_name varchar(25),
PRIMARY KEY (employee_id)) PARTITION BY RANGE (hire_date) ;

YugabyteDB will throw this error:

ERROR:  insufficient columns in the PRIMARY KEY constraint definition
DETAIL:  PRIMARY KEY constraint on table "employees" lacks column "hire_date" which is part of the partition key.

Workaround: Add all Partition columns to Primary Key

CREATE TABLE employees (
employee_id integer NOT NULL,
first_name varchar(20),
last_name varchar(25),
email varchar(25),
phone_number varchar(20),
hire_date timestamp DEFAULT statement_timestamp(),
job_id varchar(10),
salary double precision,
part_name varchar(25),
PRIMARY KEY (employee_id, hire_date)) PARTITION BY RANGE (hire_date) ;
@github-actions github-actions bot added the triage Needs to be triaged label Nov 10, 2022
@sanyamsinghal sanyamsinghal changed the title Partition Key column not part of Primary Key columns [Oracle/MySQL] Partition Key column not part of Primary Key columns Nov 10, 2022
@kneeraj kneeraj added documentation Improvements or additions to documentation and removed triage Needs to be triaged labels Nov 17, 2022
priyanshi-yb added a commit that referenced this issue Nov 18, 2022
@shubham-yb shubham-yb added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jan 5, 2023
@shubham-yb shubham-yb changed the title [Oracle/MySQL] Partition Key column not part of Primary Key columns [Oracle] Partition Key column not part of Primary Key columns Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants