[ 
https://issues.apache.org/jira/browse/CASSANDRA-20276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17925204#comment-17925204
 ] 

Stefan Miklosovic commented on CASSANDRA-20276:
-----------------------------------------------

While testing, I have identified these issues: 
{code}
CREATE TABLE ks.tb2 (
    id int,
    cl1 int,
    cl2 int,
    val text CHECK NOT_NULL(val),
    PRIMARY KEY (id, cl1, cl2)
) 

cassandra@cqlsh> INSERT INTO ks.tb2 (id, cl1, cl2, val) VALUES ( 1, 2, 3, null);
InvalidRequest: Error from server: code=2200 [Invalid query] message="Column 
value does not satisfy value constraint for column 'val' as it is null."

cassandra@cqlsh> INSERT INTO ks.tb2 (id, cl1, cl2) VALUES ( 1, 2, 3);
cassandra@cqlsh> select * from ks.tb2;

 id | cl1 | cl2 | val
----+-----+-----+------
  1 |   2 |   3 | text

(1 rows)
cassandra@cqlsh> INSERT INTO ks.tb2 (id, cl1, cl2) VALUES ( 1, 2, 4);
cassandra@cqlsh> select * from ks.tb2;

 id | cl1 | cl2 | val
----+-----+-----+------
  1 |   2 |   3 | text
  1 |   2 |   4 | null

(2 rows)
{code}

I strongly believe we should spend a little bit more time on this to deliver 
something complete. There is nowhere to hurry here and I would rather see 
something truly finished then to return to it again.

We also need to disable this:

{code}
CREATE TABLE ks.tb (id int CHECK NOT_NULL(id) PRIMARY KEY) 
{code}

This does not make sense to support, check's code is not even exercised I 
think. It fails somewhere else.

> Add not null constraint
> -----------------------
>
>                 Key: CASSANDRA-20276
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20276
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: Feature/Constraints
>            Reporter: Bernardo Botella Corbi
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Add a new constraint that checks if a column is null, as defined in CEP-42: 
> https://cwiki.apache.org/confluence/display/CASSANDRA/CEP-42%3A+Constraints+Framework



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to