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

"Numeric value out of range" then filtering on a numeric table column #11

Open
markus-hsk opened this issue Mar 12, 2020 · 18 comments
Open
Labels

Comments

@markus-hsk
Copy link

markus-hsk commented Mar 12, 2020

We are getting the Error [IBM][System i Access ODBC Driver]Column 3: Numeric value out of range. by using the loopback-connector-ibmi. We debugged through the progress and found out, that it happens on filtering records by a numeric field which is allowed to contain 7 digits. The given filter got a value with 8 digits.

Our database table column is defined like this: KOATRNR NUMERIC(7,0)

Our filter-Json, which we are passing to the ODBC-connector, looks like this:
{where: {KOARTNR: {inq: [1,1234567,12345678]}}}

As you can see, the last value contains a number with 8 digits, one more as the table column is capable to store. The interesting point is, a simple SQL-SELECT like this SELECT * FROM table WHERE KOARTNR IN (1,1234567,12345678) works without an error.

Based on the above data we are now assuming, that there might be a bug inside the connector.

Fehler Loopback 11 03 2020

Currently using these versions:

    "@loopback/boot": "^1.5.6",
    "@loopback/context": "^1.23.0",
    "@loopback/core": "^1.10.2",
    "@loopback/openapi-v3": "^1.9.7",
    "@loopback/repository": "^1.14.0",
    "@loopback/rest": "^1.19.0",
    "@loopback/rest-explorer": "^1.3.7",
    "@loopback/service-proxy": "^1.3.6",
    "dotenv": "^8.2.0",
    "loopback-connector-ibmi": "^1.0.0-beta.1"
    "@loopback/build": "^2.0.11",
    "source-map-support": "^0.5.13",
    "@loopback/testlab": "^1.8.1",
    "@types/node": "^10.14.18",
    "@typescript-eslint/parser": "^2.3.0",
    "@typescript-eslint/eslint-plugin": "^2.3.0",
    "@loopback/eslint-config": "^4.1.0",
    "eslint": "^6.4.0",
    "eslint-config-prettier": "^6.3.0",
    "eslint-plugin-eslint-plugin": "^2.1.0",
    "eslint-plugin-mocha": "^6.1.1",
    "typescript": "~3.6.3"
@stale
Copy link

stale bot commented May 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 13, 2020
@markus-hsk
Copy link
Author

This is still an issue.

@stale stale bot removed the stale label May 13, 2020
@markdirish
Copy link
Contributor

Sorry, my fault that this got marked stale. I'll take a look at this today.

I'm curious as to what SQL it is generating. Could you maybe change the executeSQL function in lib/imbiconnector.js' to print the sqlandparametersvariables at the top of the function withconsole.log`? That would help give me some clues

@markus-hsk
Copy link
Author

I'm sorry for not responding, yet. Made a ticket for my colleague, but he had not the time to look into it, yet. I think it will take a while, till we're able to look on this again.

@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 25, 2020
@markus-hsk
Copy link
Author

unstale
Coworker still had no time for checking.

@stale stale bot removed the stale label Jul 27, 2020
@markus-hsk
Copy link
Author

Hi @markdirish
I'm sorry that it took so long, but now my colleague was finally able to do what you requested.

SQL: SELECT "KOART#","KOUVP","KOSTAT" FROM "WINKLERC"."KOPUG" WHERE ("KOART#"=?) AND ("KOSTAT"=?) ORDER BY "KOART#" FETCH FIRST 1 ROWS ONLY
params: 80901420,A
options: {}

@stale
Copy link

stale bot commented Oct 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 12, 2020
@markus-hsk
Copy link
Author

unstale
not yet solved

@stale stale bot removed the stale label Oct 12, 2020
@markdirish
Copy link
Contributor

Sorry Markus, didn't mean to let this get stale. I'm pretty sure I know the issue, the ODBC driver gets upset when it tries to pass a signed smallint value to an unsigned smallint. This is a problem in the odbc connector package. I have a big update to that package coming hopefully this week or next that should fix a lot of these data type issues. I will be sure to update this issue when I push it.

@markus-hsk
Copy link
Author

No need to say sorry - everything fine so far!

@nedi-dev
Copy link

nedi-dev commented Nov 3, 2020

@markdirish : You mentioned a new version of the ODBC-driver coming up soon.
Do you mean 2.3.5 from 09/14/2020?
When do you plan to publish the next version?

@markdirish
Copy link
Contributor

@markus-hsk and @nedi-dev

I know this is a long time later, but 2.4.0 beta is out now and should be available by running npm install odbc@beta.

I am fairly sure this if fixed in that push. I was able to recreate the error on the latest branch (2.3.6), but 2.4.0-beta.1 doesn't choke on the same query. If you could install it and run the same commands that were causing the issue, that would be great.

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 26, 2021
@markdirish markdirish removed the stale label Jun 28, 2021
@markdirish
Copy link
Contributor

odbc 2.4.0 is now published. I will create PR to require this latest version, which fixes the "Numeric value out of range" issue.

markdirish added a commit to markdirish/loopback-connector-ibmi that referenced this issue Jul 14, 2021
Bump  connection version to ^2.4.0 to fix underlying issues

Fixes loopbackio#11

Signed-off-by: Mark Irish <[email protected]>
@stale
Copy link

stale bot commented Sep 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 12, 2021
@markus-hsk
Copy link
Author

unstale

@stale stale bot removed the stale label Sep 22, 2021
@stale
Copy link

stale bot commented Nov 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants