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

Support not-null constraints #125

Closed
eolivelli opened this issue Jun 29, 2017 · 9 comments
Closed

Support not-null constraints #125

eolivelli opened this issue Jun 29, 2017 · 9 comments

Comments

@eolivelli
Copy link
Contributor

eolivelli commented Jun 29, 2017

  • support 'NOT NULL' at DDL level during "CREATE TABLE' and 'ADD COLUMN'
  • enforce "NOT NULL' during DML operations
  • inform Calcite that the column is NOT NULL (the Planner will keep it in consideration)

In the first implementation it is not needed to support 'NOT NULL' in ALTER TABLE DDL, because it would imply to check that the column is 'NOT NULL' for each record and this should be done in transaction with the DDL operation.

@eolivelli
Copy link
Contributor Author

  1. Support basic NOT NULL constrains
  2. Support for JDBC metadata

beside note:
implicitly PK columns are "not null" so it must be reported by metadata

@eolivelli eolivelli added this to the 1.1 milestone Jun 29, 2017
@eolivelli eolivelli modified the milestones: 1.1, 1.2 Sep 28, 2017
@eolivelli eolivelli modified the milestones: 1.2, 1.3 Oct 13, 2017
@eolivelli
Copy link
Contributor Author

@amitvc this could be a good starting point.

@amitvc
Copy link
Contributor

amitvc commented Feb 21, 2019

I will start work on this starting today.

@eolivelli
Copy link
Contributor Author

@amitvc
this is where we handle columns in CREATE TABLE

for (ColumnDefinition cf : s.getColumnDefinitions()) {

for DDL we are using jsqlparser and not Calcite (it is not directly actually supporteb by Calcite)

You can start checking tests in
https://github.com/diennea/herddb/blob/master/herddb-core/src/test/java/herddb/core/CreateTableTest.java
https://github.com/diennea/herddb/blob/master/herddb-core/src/test/java/herddb/core/AlterTablespaceSQLTest.java
https://github.com/diennea/herddb/blob/master/herddb-core/src/test/java/herddb/core/AlterTableSQLTest.java

The first step is to differenziate NULLABLE data types from NOT_NULLABLE data types here:
https://github.com/diennea/herddb/blob/master/herddb-core/src/main/java/herddb/model/ColumnTypes.java

for instance current 'STRING' data type will become NULLABLE_STRING, and you will introduce NOT_NULLABLE_STRING

@eolivelli
Copy link
Contributor Author

I will write more ideas this evening

@amitvc
Copy link
Contributor

amitvc commented Feb 25, 2019

@eolivelli thanks for the input.

@eolivelli
Copy link
Contributor Author

@amitvc sorry for late reply.
The idea behind creating new column types is that if we add a new 'boolean' field to 'column' we will have to pass it down in all code paths and this will make us use more CPU cycles (passing parameters....) and error prone

@eolivelli eolivelli removed this from the 1.3 milestone Mar 1, 2019
@aluccaroni
Copy link
Contributor

@eolivelli @amitvc this can be closed?

@amitvc
Copy link
Contributor

amitvc commented Jun 17, 2019

I think so. This is merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants