Bug 1248489
Summary: | DB2 - error getting substring if "from position" is out of range | ||
---|---|---|---|
Product: | [JBoss] JBoss Data Virtualization 6 | Reporter: | Juraj Duráni <jdurani> |
Component: | Teiid | Assignee: | Van Halbert <vhalbert> |
Status: | CLOSED UPSTREAM | QA Contact: | Juraj Duráni <jdurani> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.2.0 | CC: | atangrin, dlesage, drieden, vhalbert |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: |
When using DB2, if the second argument of a SUBSTRING(x,y,z) function is out of the range of the first argument, users will encounter an exception.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2017-02-22 17:55:15 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Juraj Duráni
2015-07-30 12:00:10 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-3600 to Resolved This has bee resolved upstream on the 8.12 Teiid branch. Steven Hawkins <shawkins> updated the status of jira TEIID-3600 to Closed The issue is still present. Source-specific command has changed, but exception is thrown anyway. Source-specific command: SELECT substr(varchar(g_0.TIMESTAMPVALUE), CASE WHEN 40 > 0 THEN 0 ELSE 40 END, CASE WHEN 0 > (length(varchar(g_0.TIMESTAMPVALUE)) - (CASE WHEN 40 > 0 THEN 0 ELSE 40 END - 1)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) - (CASE WHEN 40 > 0 THEN 0 ELSE 40 END - 1)) ELSE 0 END) FROM SMALLA AS g_0 WHERE g_0.INTKEY = 1 Result: Caused by: com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-138, SQLSTATE=22011, SQLERRMC=null, DRIVER=4.12.55 Van Halbert <vhalbert> updated the status of jira TEIID-3600 to Reopened Steven Hawkins <shawkins> updated the status of jira TEIID-3600 to Resolved The query is still failing. I can see condition in the source-specific command like follows: CASE WHEN 40 > length(varchar(g_0.TIMESTAMPVALUE)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) + 1) I believe that this is wrong as (length(varchar(g_0.TIMESTAMPVALUE)) + 1) is obviously greater than length(varchar(g_0.TIMESTAMPVALUE)) which actually causes the exception. Source-specific command: SELECT substr(varchar(g_0.TIMESTAMPVALUE), CASE WHEN 40 > length(varchar(g_0.TIMESTAMPVALUE)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) + 1) ELSE 40 END, CASE WHEN 0 > (length(varchar(g_0.TIMESTAMPVALUE)) - (CASE WHEN 40 > length(varchar(g_0.TIMESTAMPVALUE)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) + 1) ELSE 40 END - 1)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) - (CASE WHEN 40 > length(varchar(g_0.TIMESTAMPVALUE)) THEN (length(varchar(g_0.TIMESTAMPVALUE)) + 1) ELSE 40 END - 1)) ELSE 0 END) FROM SMALLA AS g_0 WHERE integer(g_0.INTKEY) = 1 Juraj Duráni <jdurani> updated the status of jira TEIID-3600 to Reopened I am sorry. Setting to from NEW to ASSIGNED. Steven Hawkins <shawkins> updated the status of jira TEIID-3600 to Resolved |