[
https://issues.apache.org/jira/browse/PHOENIX-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13972358#comment-13972358
]
James Taylor commented on PHOENIX-923:
--------------------------------------
It's still ok for a composite key to define all columns as NULL. Sometimes
there are use cases where one or the other column will be null and you don't
know which one in advance.
> when I create table, the column without assign any column family. the NOT
> NULL keywords is not take effect
> -------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-923
> URL: https://issues.apache.org/jira/browse/PHOENIX-923
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 3.0.0
> Reporter: jay wong
> Fix For: 3.0.0
>
> Attachments: PHOENIX-923.patch, PHOENIX-923v2.patch
>
>
> eg:
> create table if not exists table_test
> varchar_pk VARCHAR NOT NULL,
> char_pk CHAR(5) NOT NULL,
> int_column INTEGER NOT NULL,
> int_column_b INTEGER NOT NULL
> CONSTRAINT pk PRIMARY KEY (varchar_pk, char_pk);
> the create ddl sql is all right execute well.
> but if I upsert a record without int_column and int_column_b, it is also be
> insert. so the NOT NULL isn't take effect
> Also create ddl sql is:
> create table if not exists table_test
> varchar_pk VARCHAR NOT NULL,
> char_pk CHAR(5) NOT NULL,
> A.int_column INTEGER NOT NULL,
> A.int_column_b INTEGER NOT NULL
> CONSTRAINT pk PRIMARY KEY (varchar_pk, char_pk);
> it throw:
> java.sql.SQLException: ERROR 1007 (42K01): A key/value column may not be
> declared as not null. columnName=A.INT_COLUMN
> so Why assign any column family and not assign the worked difference?
> I found MetaDataClient#newColumn logic is tricky.
> the code just want system table didn't check not null, so the default column
> family name not check. but user table is also can use default column family.
> so I do some adjust for the code here
>
--
This message was sent by Atlassian JIRA
(v6.2#6252)