You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Avi Kivity (Jira)" <ji...@apache.org> on 2022/06/15 17:01:00 UTC

[jira] [Updated] (CASSANDRA-17693) Missing type checking on reused bind variables

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

Avi Kivity updated CASSANDRA-17693:
-----------------------------------
    Description: 
A bind variable gets its type from its context (e.g. in {{INSERT INTO tab(a) VALUES(:var, :var)}} has the same type as {{tab.a}}. But what if the same variable is used in contexts that have different types? Assume {{a}} and {{b}} have incompatible types:

{{INSERT INTO ks.tab (id, a, b) VALUES(:id, :a, :a)}}


The server should reject the query, but it doesn't.

I think what happens is that one :a shadows the other, so the other :a can't even get a value.

More complete reproducer attached.

  was:
A bind variable gets its type from its context (e.g. in {{INSERT INTO tab(a) VALUES(:var, :var)}} has the same type as {{{}tab.a{}}}). But what if the same variable is used in contexts that have different types? Assume {{a}} and {{b}} have incompatible types:

{{INSERT INTO ks.tab (id, a, b) VALUES(:id, :a, :a)}}


The server should reject the query, but it doesn't.

I think what happens is that one :a shadows the other, so the other :a can't even get a value.

More complete reproducer attached.


> Missing type checking on reused bind variables
> ----------------------------------------------
>
>                 Key: CASSANDRA-17693
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17693
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Avi Kivity
>            Priority: Normal
>         Attachments: bind-var-type-conflict.py
>
>
> A bind variable gets its type from its context (e.g. in {{INSERT INTO tab(a) VALUES(:var, :var)}} has the same type as {{tab.a}}. But what if the same variable is used in contexts that have different types? Assume {{a}} and {{b}} have incompatible types:
> {{INSERT INTO ks.tab (id, a, b) VALUES(:id, :a, :a)}}
> The server should reject the query, but it doesn't.
> I think what happens is that one :a shadows the other, so the other :a can't even get a value.
> More complete reproducer attached.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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