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

Stefan Miklosovic updated CASSANDRA-17878:
------------------------------------------
    Description: 
There is currently this in PropertyDefinitions class as a pattern we use for 
testing a boolean value in cqlsh

{code}
private static final Pattern PATTERN_POSITIVE = Pattern.compile("(1|true|yes)");
{code}

This might be source of mistakes and typos. For example, if a user does, for 
example:

{code}
ALTER TABLE ks.tb WITH cdc = tru;
{code}

If he does not notice it, he thinks that cdc is true, but it is not. 

More to it, currently, everything which is not "1", "true", or "yes" is 
evaluated as false. We should harden this in such a way that both logical true 
and false would be parsed only on well defined values and every other value 
would be rejected and a query would fail.

  was:
There is currently this in PropertyDefinitions class as a pattern we use for 
testing a boolean value in cqlsh

{code}
private static final Pattern PATTERN_POSITIVE = Pattern.compile("(1|true|yes)");
{code}

This might be source of mistakes and typos. For example, if a user does, for 
example:

{code}
ALTER TABLE ks.tb WITH cdc = tru;
{code}

If he does not notice it, he thinks that cdc is true, but it is not. 

More to it, currently, everything which is not "1", "true", or "yes" is 
evaluated as false. We should harden this in such a way that both logical true 
and false would be parsed only on a well defined values and every other value 
would be rejected and a query would fail.


> Harden parsing of boolean values in CQL in PropertyDefinitions
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-17878
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17878
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter, CQL/Semantics
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>
> There is currently this in PropertyDefinitions class as a pattern we use for 
> testing a boolean value in cqlsh
> {code}
> private static final Pattern PATTERN_POSITIVE = 
> Pattern.compile("(1|true|yes)");
> {code}
> This might be source of mistakes and typos. For example, if a user does, for 
> example:
> {code}
> ALTER TABLE ks.tb WITH cdc = tru;
> {code}
> If he does not notice it, he thinks that cdc is true, but it is not. 
> More to it, currently, everything which is not "1", "true", or "yes" is 
> evaluated as false. We should harden this in such a way that both logical 
> true and false would be parsed only on well defined values and every other 
> value would be rejected and a query would fail.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to