Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NNSqlValue has suspicious behavior around boundaries #106

Open
laysakura opened this issue Feb 1, 2021 · 2 comments
Open

NNSqlValue has suspicious behavior around boundaries #106

laysakura opened this issue Feb 1, 2021 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@laysakura
Copy link
Contributor

laysakura commented Feb 1, 2021

  • negate() seems to fail in treat i64::MIN ( since |i64::MIN| == |i64::MAX| + 1 )
  • Following test fails. ASTTranslator::integer_constant() should input positive number in string form ( - comes as UnaryOperator ). |i64::MIN| exceeds i64.
#[async_std::test]
async fn test_big_int() {
    SqlTest::default()
        .add_steps(Steps::BeginTransaction)
        .add_step(Step::new(
            "CREATE TABLE t (c BIGINT, PRIMARY KEY (c))",
            StepRes::Ok,
        ))
        .add_step(Step::new(
            format!("INSERT INTO t (c) VALUES ({})", i64::MIN),
            StepRes::Ok,
        ))
        .run()
        .await;
}
thread 'proptest_big_int' panicked at 'unexpected error ApllodbError {
    kind: NumericValueOutOfRange,
    desc: "integer value `9223372036854775808` could not be parsed as i64 (max supported size)",
    source: Some(
        ParseIntError {
            kind: PosOverflow,
        },
    ),
} on ApllodbServer::command() - step: Step {
    sql: "INSERT INTO t (c) VALUES (-9223372036854775808)",
    expected: StepRes::Ok,
}', apllodb-server/tests/sql_test/step.rs:81:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@laysakura laysakura changed the title NNSqlValue、境界値の挙動が多分怪しい NNSqlValue、整数境界値の挙動が多分怪しい Feb 1, 2021
@laysakura laysakura added the bug Something isn't working label Feb 1, 2021
@laysakura
Copy link
Contributor Author

laysakura commented Feb 1, 2021

なかなかエレガントな解法が思いつかないのでpend。

仕様として、 「SMALLINTは -i16::MAX ~ i16::MAX」 としてしまうのも手(一応SQL標準は確認したいが)。

@laysakura laysakura mentioned this issue Feb 1, 2021
laysakura added a commit that referenced this issue Feb 1, 2021
* i32 cannot get as i16

* test_small_int()

* adds test_big_int (failing)

* MINの境界値は #106 につき諦めた
@laysakura laysakura added this to the future milestone Feb 1, 2021
@laysakura
Copy link
Contributor Author

一応SQL標準は確認したいが

https://www.postgresql.jp/document/12/html/datatype-numeric.html
普通に i16::MIN ~ i16::MAX でした 🙄

@laysakura laysakura changed the title NNSqlValue、整数境界値の挙動が多分怪しい NNSqlValue has suspicious behavior around boundaries May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant