[ 
https://issues.apache.org/jira/browse/PHOENIX-923?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

jay wong updated PHOENIX-923:
-----------------------------

    Description: 
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

 

  was:
#### 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

 


> 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
>            Reporter: jay wong
>         Attachments: PHOENIX-923.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)

Reply via email to