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

Krisztian Kasa resolved HIVE-25512.
-----------------------------------
    Resolution: Fixed

Pushed to master. Thanks [~kgyrtkirk] for review.

> Merge statement does not enforce check constraints
> --------------------------------------------------
>
>                 Key: HIVE-25512
>                 URL: https://issues.apache.org/jira/browse/HIVE-25512
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {code}
> set hive.support.concurrency=true;
> set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
> CREATE TABLE table_check_merge(
> name string CHECK (length(name)<=20),
> age int,
> gpa double CHECK (gpa BETWEEN 0.0 AND 4.0)
> ) stored as orc TBLPROPERTIES ('transactional'='true');
> CREATE TABLE table_source( name string, age int, gpa double);
> insert into table_source(name, age, gpa) values ('student1', 16, null), 
> (null, 20, 4.0);
> insert into table_check_merge(name, age, gpa) values ('student1', 16, 2.0);
> merge into table_check_merge using (select age from table_source)source
> on source.age=table_check_merge.age
> when matched then update set gpa=6;
> {code}
> Merge statement tries to update gpa to 6 which is not between 0.0 and 4.0.
> However the update succeeds.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to