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 "Dag H. Wanvik (JIRA)" <ji...@apache.org> on 2009/10/27 18:16:59 UTC

[jira] Created: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
-----------------------------------------------------------------------------------------

                 Key: DERBY-4426
                 URL: https://issues.apache.org/jira/browse/DERBY-4426
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.5.3.0, 10.5.2.0, 10.5.1.1
            Reporter: Dag H. Wanvik
            Priority: Minor


Repro on trunk:

 create table mytab (i int generated always as (j*2), j int);
insert into tt values (default,1) union values (default,2);

ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
	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)
Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
	... 17 more
Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)


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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: releaseNote.html

Another slightly improved version of the releaseNote, making explicit that the compiler gives
a statement severity level error (42Y85).

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

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

Marking Release Note needed.


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770589#action_12770589 ] 

Dag H. Wanvik commented on DERBY-4426:
--------------------------------------

This is related to DERBY-4413, it's just that in this case the sorting
happens as a part of evaluating a UNION, and this time, the empty
"stub" column of the generated column (to be filled in later), *is*
part of the sort key.

I have revisited the standard here, and it seems DEFAULT is actually
not allowed inside the UNION here: The production that allows DEFAULT
as part of its derivation is the <contextually typed table
constructor> (SQL 2003, section 7.3), which is only used in a
production here:

<insert statement> ::=
   INSERT INTO <insertion target> <insert columns and source>
   <insertion target> ::= <table name>
   <insert columns and source> ::=
   <from subquery>
   | <from constructor>
   | <from default>

<from constructor> ::=
   [ <left paren> <insert column list> <right paren> ]
   [ <override clause> ]
   <contextually typed table value constructor>

If a UNION is present, it is derivable only via the <from subquery>,
which in turn leads to a "normal" <table value constructor>,
cf. section 7.13 <query expression>:

<simple table> ::=
   <query specification>
   | <table value constructor>
   | <explicit table>

and I can't see that DEFAULT is allowed as part of a  <table value
constructor>. This seems reasonable, because the default values should
logically be applied only after the result set has been computed, cf
arguments for this in DERBY-4413.
https://issues.apache.org/jira/browse/DERBY-4413?focusedCommentId=12769532&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12769532

If the column behind the DEFAULT is an identity column or a normal
base column, the query succeeds, so I would say we are too liberal
here. It only works because in those two cases, the values are
assigned "early" in the sense of DERBY-4413.

Tagging this issue with "Deviation from standard".


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into tt values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Bug behavior facts: [Deviation from standard]

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into tt values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

-- 
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-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770589#action_12770589 ] 

Dag H. Wanvik edited comment on DERBY-4426 at 10/27/09 5:40 PM:
----------------------------------------------------------------

This is related to DERBY-4413, it's just that in this case the sorting
happens as a part of evaluating a UNION, and this time, the empty
"stub" column of the generated column (to be filled in later), *is*
part of the sort key.

I have revisited the standard here, and it seems DEFAULT is actually
not allowed inside the UNION here: The production that allows DEFAULT
as part of its derivation is the <contextually typed table
constructor> (SQL 2003, section 7.3), which is only used in a
production here:

<insert statement> ::=
   INSERT INTO <insertion target> <insert columns and source>
   <insertion target> ::= <table name>
   <insert columns and source> ::=
   <from subquery>
   | <from constructor>
   | <from default>

<from constructor> ::=
   [ <left paren> <insert column list> <right paren> ]
   [ <override clause> ]
   <contextually typed table value constructor>

If a UNION is present, it is derivable only via the <from subquery>,
which in turn leads to a "normal" <table value constructor>,
cf. section 7.13 <query expression>:

<simple table> ::=
   <query specification>
   | <table value constructor>
   | <explicit table>

and I can't see that DEFAULT is allowed as part of a  <table value
constructor>. This seems reasonable, because the default values should
logically be applied only after the result set has been computed, cf
arguments for this in DERBY-4413.
https://issues.apache.org/jira/browse/DERBY-4413?focusedCommentId=12769532&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12769532

If the column behind the DEFAULT is an identity column or a normal
base column, the query succeeds, so I would say we are too liberal
here. It only works because in those two cases, the values are
assigned "early" in the sense of DERBY-4413, so the sorting needed by
UNION can work for the default columns.

Tagging this issue with "Deviation from standard".


      was (Author: dagw):
    This is related to DERBY-4413, it's just that in this case the sorting
happens as a part of evaluating a UNION, and this time, the empty
"stub" column of the generated column (to be filled in later), *is*
part of the sort key.

I have revisited the standard here, and it seems DEFAULT is actually
not allowed inside the UNION here: The production that allows DEFAULT
as part of its derivation is the <contextually typed table
constructor> (SQL 2003, section 7.3), which is only used in a
production here:

<insert statement> ::=
   INSERT INTO <insertion target> <insert columns and source>
   <insertion target> ::= <table name>
   <insert columns and source> ::=
   <from subquery>
   | <from constructor>
   | <from default>

<from constructor> ::=
   [ <left paren> <insert column list> <right paren> ]
   [ <override clause> ]
   <contextually typed table value constructor>

If a UNION is present, it is derivable only via the <from subquery>,
which in turn leads to a "normal" <table value constructor>,
cf. section 7.13 <query expression>:

<simple table> ::=
   <query specification>
   | <table value constructor>
   | <explicit table>

and I can't see that DEFAULT is allowed as part of a  <table value
constructor>. This seems reasonable, because the default values should
logically be applied only after the result set has been computed, cf
arguments for this in DERBY-4413.
https://issues.apache.org/jira/browse/DERBY-4413?focusedCommentId=12769532&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12769532

If the column behind the DEFAULT is an identity column or a normal
base column, the query succeeds, so I would say we are too liberal
here. It only works because in those two cases, the values are
assigned "early" in the sense of DERBY-4413.

Tagging this issue with "Deviation from standard".

  
> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into tt values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: derby-4426.stat
                derby-4426.diff

Uploading a patch that checks for illegal use of DEFAULT inside top level set operators with an INSERT (inside subqueries, illegal use of DEFAULT is already being caught).
Added test cases to ColumnDefaultsTest and GeneratedColumnsTest.

Running regressions.


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: derby-4426c.stat
                derby-4426c.diff

Thanks, Knut. I agree it would be good to move that no-op to SelectNode, so as to catch
any wrong usage in the future, uploading patch derby-4426c for that, rerunning regressions.

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, derby-4426c.diff, derby-4426c.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780649#action_12780649 ] 

Dag H. Wanvik commented on DERBY-4426:
--------------------------------------

+1 to forbid using DEFAULT in UNION.


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783076#action_12783076 ] 

Knut Anders Hatlen commented on DERBY-4426:
-------------------------------------------

The patch and the release note look good to me. (But perhaps change "toes to the SQL standard" to "follows the SQL standard"?)

According to the test coverage reports, SingleChildResultSetNode.replaceDefaults() is never called by the existing tests. I haven't checked if any of your tests exercise that code path, but assuming they don't, do you know of a way to devise a test for it to verify that the changes are correct?

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Assigned: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik reassigned DERBY-4426:
------------------------------------

    Assignee: Dag H. Wanvik

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Resolved: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik resolved DERBY-4426.
----------------------------------

          Resolution: Fixed
    Issue & fix info: [Release Note Needed, Repro attached]  (was: [Repro attached, Release Note Needed, Patch Available])

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, derby-4426c.diff, derby-4426c.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment:     (was: derby-4426.diff)

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783888#action_12783888 ] 

Dag H. Wanvik commented on DERBY-4426:
--------------------------------------

Committed derby-4426c as svn 885595.


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, derby-4426c.diff, derby-4426c.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: releaseNote.html
                derby-4426b.stat
                derby-4426b.diff

Attaching a revision "b" of this patch, which moves the method from FromTableNode to SetOperatorNode (more accurate here), and also removes it from SingleChildResultSetNode (not needed). Added one more test case to ColumnDefaultsTest to show that we do catch illegal DEFAULT inside subqueries in an INSERT context, as well. Also fixed some mixed tab/whitespace resulting from cut/paste work.

Changed the wording as suggested by Knut for releaseNotes.html, uploading new rev.

Re-running regressions.

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Closed: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik closed DERBY-4426.
--------------------------------


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, derby-4426c.diff, derby-4426c.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Description: 
Repro on trunk:

 create table mytab (i int generated always as (j*2), j int);
insert into mytab values (default,1) union values (default,2);

ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
	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)
Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
	... 17 more
Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)


  was:
Repro on trunk:

 create table mytab (i int generated always as (j*2), j int);
insert into tt values (default,1) union values (default,2);

ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
	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)
Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
	... 17 more
Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)



> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780631#action_12780631 ] 

Knut Anders Hatlen commented on DERBY-4426:
-------------------------------------------

Also note that we don't generally allow VALUES DEFAULT in sub-queries, even in an INSERT context:

ij> insert into t2 select * from (values default) v;
ERROR 42Y85: The DEFAULT keyword is only allowed in a VALUES clause when the VALUES clause appears within an INSERT statement.

I think the reason why it's accepted in UNIONs, is that multi-row VALUES queries happen to be implemented as UNIONs of single-row VALUES queries. I'd say we should forbid using DEFAULT in UNION too.

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

-- 
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-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783129#action_12783129 ] 

Dag H. Wanvik edited comment on DERBY-4426 at 11/27/09 4:25 PM:
----------------------------------------------------------------

Attaching a revision "b" of this patch, which moves the method from TableOperatorNode to SetOperatorNode (more accurate here), and also removes it from SingleChildResultSetNode (not needed). Added one more test case to ColumnDefaultsTest to show that we do catch illegal DEFAULT inside subqueries in an INSERT context, as well. Also fixed some mixed tab/whitespace resulting from cut/paste work.

Changed the wording as suggested by Knut for releaseNotes.html, uploading new rev.

Re-running regressions.

      was (Author: dagw):
    Attaching a revision "b" of this patch, which moves the method from FromTableNode to SetOperatorNode (more accurate here), and also removes it from SingleChildResultSetNode (not needed). Added one more test case to ColumnDefaultsTest to show that we do catch illegal DEFAULT inside subqueries in an INSERT context, as well. Also fixed some mixed tab/whitespace resulting from cut/paste work.

Changed the wording as suggested by Knut for releaseNotes.html, uploading new rev.

Re-running regressions.
  
> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: releaseNote.html

Attaching release note.

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783195#action_12783195 ] 

Dag H. Wanvik commented on DERBY-4426:
--------------------------------------

As to your comment, Knut "do you know of a way to devise a test for it
to verify that the changes are correct?", I am not sure that I do,
except for studying the code as to what top level result sets at this
point of processing in an INSERT can have DEFAULT syntactically,
outside subqueries, and adding test cases for those. The catch-all
method in RSN does nothing.


> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

-- 
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-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783007#action_12783007 ] 

Dag H. Wanvik edited comment on DERBY-4426 at 11/27/09 1:55 AM:
----------------------------------------------------------------

Marking Release Note needed, since this case for example used to work:

create table neg(c1 int default 10);
insert into neg values (default) union values (default);

but would now be flagged.

      was (Author: dagw):
    Marking Release Note needed.

  
> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Updated: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

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

Dag H. Wanvik updated DERBY-4426:
---------------------------------

    Attachment: derby-4426.diff

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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


[jira] Commented: (DERBY-4426) With generated columns, INSERT with DEFAULT inside a VALUES clause inside a UNION fails.

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783611#action_12783611 ] 

Knut Anders Hatlen commented on DERBY-4426:
-------------------------------------------

Thanks for the new patch. It looks good to me. I think removing the method from SingleChildResultSetNode is safe since the VALUES clause must be hidden in a subquery if that node is the top-level source for the insert. Also, it seems like in the phase where replaceDefaults() is called, the source for the insert is still a SelectNode if it's not a subclass of SetOperatorNode. So it seems like replaceDefaults() is currently a no-op in all cases, except set operations, so your restructuring of the code makes sense.

Perhaps, just to verify that this assumption holds and doesn't change later, we could adjust the patch slightly:

  - Make the default implementation in ResultSetNode throw an assert error
  - Override the method in SelectNode. The override should be a no-op (with a comment saying that DEFAULTs in select lists or subqueries are rejected elsewhere)

I'm +1 to the patch with or without that change.

The release note also looks fine.

> With generated columns,  INSERT with DEFAULT inside a VALUES clause inside a UNION fails.
> -----------------------------------------------------------------------------------------
>
>                 Key: DERBY-4426
>                 URL: https://issues.apache.org/jira/browse/DERBY-4426
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.1.1, 10.5.2.0, 10.5.3.0
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-4426.diff, derby-4426.stat, derby-4426b.diff, derby-4426b.stat, releaseNote.html, releaseNote.html, releaseNote.html
>
>
> Repro on trunk:
>  create table mytab (i int generated always as (j*2), j int);
> insert into mytab values (default,1) union values (default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
> 	at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
> 	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2204)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1323)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:625)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
> 	at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
> 	at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:521)
> 	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)
> Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col[0] is null: org.apache.derby.shared.common.sanity.AssertFailure'.
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
> 	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
> 	... 17 more
> Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col[0] is null
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
> 	at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
> 	at org.apache.derby.impl.store.access.sort.MergeSort.checkColumnTypes(MergeSort.java:474)
> 	at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:326)
> 	at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:270)
> 	at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:415)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1235)

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