You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/10/13 14:50:31 UTC

[jira] Created: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

StringIndexOutOfBoundsException in ij when result has no columns
----------------------------------------------------------------

                 Key: DERBY-4407
                 URL: https://issues.apache.org/jira/browse/DERBY-4407
             Project: Derby
          Issue Type: Bug
          Components: Tools
    Affects Versions: 10.6.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.

After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:

ij> create table t(x int);
0 rows inserted/updated/deleted
ij> insert into t values (1),(2),(3);
3 rows inserted/updated/deleted
ij> select t1.* from t t1 join t t2 using (x);
JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
	at org.apache.derby.tools.ij.main(ij.java:59)
	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765063#action_12765063 ] 

Rick Hillegas commented on DERBY-4407:
--------------------------------------

Hi Knut,

I think that a row returned by a query must have at least column. Here's how I thread my way to this conclusion by reading part 2 of the SQL Standard:

1) The result set returned by a query expression is a kind of table called a "derived table" according to 4.14.2 "Types of tables".

2) A row in a table must have at least one column according to the previous section, 4.14.1 "Introduction to tables"


> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765063#action_12765063 ] 

Rick Hillegas edited comment on DERBY-4407 at 10/13/09 6:14 AM:
----------------------------------------------------------------

Hi Knut,

I think that a row returned by a query must have at least one column. Here's how I thread my way to this conclusion by reading part 2 of the SQL Standard:

1) The result set returned by a query expression is a kind of table called a "derived table" according to 4.14.2 "Types of tables".

2) A row in a table must have at least one column according to the previous section, 4.14.1 "Introduction to tables"


      was (Author: rhillegas):
    Hi Knut,

I think that a row returned by a query must have at least column. Here's how I thread my way to this conclusion by reading part 2 of the SQL Standard:

1) The result set returned by a query expression is a kind of table called a "derived table" according to 4.14.2 "Types of tables".

2) A row in a table must have at least one column according to the previous section, 4.14.1 "Introduction to tables"

  
> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-4407:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4407.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0

Committed revision 826616.

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: d4407-1a.diff
>
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4407:
--------------------------------------

    Component/s:     (was: Tools)
                 SQL

Thanks Rick. That sounds reasonable. So I guess a bind-time exception would be in order here, then.
Changing component from Tools to SQL, since the fix will have to go into the engine.

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4407:
--------------------------------------

    Issue & fix info: [Repro attached]  (was: [Repro attached, Patch Available])

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: d4407-1a.diff
>
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4407:
--------------------------------------

    Attachment: d4407-1a.diff

The attached patch adds a check for empty result column list in SelectNode at the same place where we check whether the result column list is too long. All the regression tests ran cleanly.

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d4407-1a.diff
>
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4407) StringIndexOutOfBoundsException in ij when result has no columns

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4407:
--------------------------------------

    Issue & fix info: [Patch Available, Repro attached]  (was: [Repro attached])

> StringIndexOutOfBoundsException in ij when result has no columns
> ----------------------------------------------------------------
>
>                 Key: DERBY-4407
>                 URL: https://issues.apache.org/jira/browse/DERBY-4407
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: d4407-1a.diff
>
>
> A query that returns no columns should perhaps raise an SQLException of some kind, I don't know, but currently it doesn't, and ij fails with a StringIndexOutOfBoundsException when it tries to display the result.
> After DERBY-4370 it is possible to construct queries that return no columns by having a select list like T1.* in a join where the USING clause contains all of T1's columns. To reproduce:
> ij> create table t(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (1),(2),(3);
> 3 rows inserted/updated/deleted
> ij> select t1.* from t t1 join t t2 using (x);
> JAVA ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> 	at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:143)
> 	at java.lang.StringBuffer.setLength(StringBuffer.java:153)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayBanner(JDBCDisplayUtil.java:627)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:368)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:338)
> 	at org.apache.derby.tools.JDBCDisplayUtil.indent_DisplayResults(JDBCDisplayUtil.java:241)
> 	at org.apache.derby.tools.JDBCDisplayUtil.DisplayResults(JDBCDisplayUtil.java:229)
> 	at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:448)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
> 	at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
> 	at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
> 	at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
> 	at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
> 	at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> 	at org.apache.derby.tools.ij.main(ij.java:59)
> 	at org.apache.derby.iapi.tools.run.main(run.java:53)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.