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

Bug: unsigned tinyint/smallint/int/bigint issue #150

Open
enix223 opened this issue Mar 16, 2024 · 0 comments · May be fixed by #151
Open

Bug: unsigned tinyint/smallint/int/bigint issue #150

enix223 opened this issue Mar 16, 2024 · 0 comments · May be fixed by #151

Comments

@enix223
Copy link

enix223 commented Mar 16, 2024

Senario:

When we declare table with unsigned tinyint, and store value larger than max value of corresponding SIGNED type, negative number is return.

Reproduce

CREATE TABLE t1 (ts TIMESTAMP, f1 TINYINT UNSINGED, f2 SMALLINT UNSIGNED, f3 INT UNSIGNED, f4 BIGINT UNSIGNED);
INSERT INTO t1 (ts, f1, f2, f3, f4) VALUES (NOW, 255, 65535, 4294967295, POW(2, 64) - 1);

Solution:

Just like the mysql-connector-j way, map TINY_UNSIGNED to Integer, SMALLINT_UNSIGNED to Integer, INT_UNSIGNED to Long, BIGINT_UNSIGNED to BigInteger.

  1. UTINYINT should use Short instead of Byte.
  2. USMALLINT should use Integer instead of Short.
  3. UINT should use Long instead of Integer.
  4. UBIGINT should use BigInteger instead of Long
enix223 added a commit to enix223/taos-connector-jdbc that referenced this issue Mar 17, 2024
enix223 added a commit to enix223/taos-connector-jdbc that referenced this issue Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant