cmu-db / peloton

The Self-Driving Database Management System
http://pelotondb.io
Apache License 2.0
2.04k stars 623 forks source link

Constraint refactoring #1415

Closed ksaito7 closed 6 years ago

ksaito7 commented 6 years ago

This PR refactors constraint stuff related to planner, executor, storage and catalog.

- Contributions

  1. Add a new catalog table for constraints: pg_constraint
  2. Clean up data structures of constraints and its usage: Table constraint (Primary key, Foreign key, Unique, Check) -> Constraint (pg_constraint) Column constraint (Not null, Default) -> Column (pg_attribute) Deleted class -> ForeignKey, MultiConstraint
  3. Add set/add/drop constraint functions in Catalog.
  4. Simplify checking of constraints in DataTable when inserting/updating.

- Related Issues

  1. 1270

- Remaining Issues

  1. Parser does not support multiple column UNIQUE constraint.
  2. CHECK constraints doesn't work when inserting/updating.
  3. CHECK constraints doesn't support multiple columns or complex formula.
  4. DDL: ADD/SET/DROP constraints are not supported.
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.08%) to 76.512% when pulling 25a3d0c2e8f045466cd1c0e8ff0df1a2122de5ee on ksaito7:pg_constraint into c949481ecb6b347fa116669cd50fc802962d3b5f on cmu-db:master.

tli2 commented 6 years ago

@ksaito7 It looks like it will conflict with #1414 like crazy. Do you mind if you rebase on that PR locally?

tli2 commented 6 years ago

@apavlo Joy wrote the original code and nobody has touched that code in a long time. I don't know if anybody else understands it so can you take a look?

ksaito7 commented 6 years ago

@tli2 Sure, I will rebase locally, and fix all tabs.