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

Improve duplicate column names validation #995

Merged
merged 10 commits into from
Nov 10, 2022

Conversation

devgony
Copy link
Collaborator

@devgony devgony commented Nov 9, 2022

Goal

1. CREATE TABLE with duplicate column name should get Error

gluesql> CREATE TABLE Item (id INT, id INT);
[error] duplicate column name: id

2. RENAME COLUMN with duplicated column name should get Error

gluesql> CREATE TABLE Item (id INT, name TEXT);
Table created

gluesql> ALTER TABLE Item RENAME COLUMN name to id;
[error] column already exists: id

3. ADD COLUMN already has validation.

Todo

  • implement validate_column_names
  • add validation to rename_column at sled-storage, memory-storage
  • rename AddColumnAlreadyExists to ColumnAlreadyExists

@devgony devgony added the improvement Improvements for existing features label Nov 9, 2022
@devgony devgony self-assigned this Nov 9, 2022
@coveralls
Copy link

coveralls commented Nov 9, 2022

Pull Request Test Coverage Report for Build 3428397148

  • 50 of 50 (100.0%) changed or added relevant lines in 6 files are covered.
  • 34 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.07%) to 98.429%

Files with Coverage Reduction New Missed Lines %
core/src/executor/aggregate/mod.rs 34 81.82%
Totals Coverage Status
Change from base Build 3421293325: -0.07%
Covered Lines: 39671
Relevant Lines: 40304

💛 - Coveralls

Copy link
Member

@ever0de ever0de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the nit comment, it looks good.

core/src/store/alter_table.rs Outdated Show resolved Hide resolved
Copy link
Member

@panarch panarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all nice! Thanks a lot 👍

@panarch panarch merged commit 28a9181 into gluesql:main Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements for existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants