db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DERBY-6368) CHECK constraints should not be allowed to invoke non-deterministic functions.
Date Wed, 02 Oct 2013 19:41:41 GMT
Rick Hillegas created DERBY-6368:
------------------------------------

             Summary: CHECK constraints should not be allowed to invoke non-deterministic
functions.
                 Key: DERBY-6368
                 URL: https://issues.apache.org/jira/browse/DERBY-6368
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.11.0.0
            Reporter: Rick Hillegas


CHECK constraints must be deterministic expressions according to the 2011 SQL Standard, part
2, section 11.9 (check constraint definition), syntax rule 5. However, Derby allows CHECK
constraints to invoke non-deterministic functions. The following script shows this:

create function parseInt( a varchar( 10 ) ) returns int
language java parameter style java
external name 'java.lang.Integer.parseInt';

-- fails because parseInt() is not deterministic
create table t1( a varchar( 10 ), b generated always as ( parseInt( a ) ) );

-- succeeds but shouldn't
create table t2( a varchar( 10 ) check ( parseInt( a ) > 0 ) );

The fix for this is probably to mimic the treatment of generation clauses.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message