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

Istvan Toth resolved PHOENIX-6794.
----------------------------------
    Resolution: Duplicate

> Default value evaluation happens in the read path
> -------------------------------------------------
>
>                 Key: PHOENIX-6794
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6794
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 5.2.0
>            Reporter: Istvan Toth
>            Priority: Major
>
> At least in some cases, the default value for a column is getting evaluated 
> during read time.
> This does not conform to the SQL standard, and results in incorrect behaviour:
> {code:java}
> create table test id integer primary key, int v1 default 20;
> upsert into test (id, v1) values (1,1)
> select v1 from test where id = 1;
> -- results in 1, correct
> upsert into test (id) values (2)
> -- v1 is not stored
> select v1 from test where id = 2;
> -- results 1, correct, because default applied during read time
> upsert into test (id, v1) values (3, null)
> -- v1 is not stored
> select v1 from test where id = 1;
> -- results 1, which is INCORRECT, as a default shouldn't override an explicit 
> NULL value{code}
> The correct behaviour would be resolving the default value during upsert, and 
> not doing any default processing during select queries.
>  
>  
>  



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

Reply via email to