Derby
  1. Derby
  2. DERBY-3395

'An ON clause associated with a JOIN operator is not valid.' failure with 10.3.2.1 passes with 10.2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 10.3.1.4, 10.3.2.1, 10.4.1.3
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None
    • Bug behavior facts:
      Regression

      Description

      There is a reproduction attached to DERBY-39 derby-joinon.tar.gz which causes the error:
      This is a regresion in 10.3.1.4. It works fine with 10.2.2.0. It is therefore a different issue than DERBY-39 which was reported against 10.0.20. In 10.3 the stack trace is below:

      java.sql.SQLSyntaxErrorException: An ON clause associated with a JOIN operator is not valid.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:91)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:202)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1573)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:144)
      at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Driver40.java:105)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:923)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:751)
      at SubShape.insert(SubShape.java:56)
      at org.apache.derby.exe.ac12564092x0117xf043xb4ffx0000001487781.g0(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:46)
      at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:74)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
      at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:173)
      at org.apache.derby.impl.sql.execute.StatementTriggerExecutor.fireTrigger(StatementTriggerExecutor.java:80)
      at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:278)
      at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1163)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:497)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:596)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
      at org.apache.derby.tools.ij.main(ij.java:71)
      Caused by: java.sql.SQLException: An ON clause associated with a JOIN operator is not valid.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:13
      5)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
      ... 35 more
      Caused by: ERROR 42972: An ON clause associated with a JOIN operator is not valid.
      at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:280)
      at org.apache.derby.impl.sql.compile.JoinNode.deferredBindExpressions(JoinNode.java:811)
      at org.apache.derby.impl.sql.compile.JoinNode.bindResultColumns(JoinNode.java:630)
      at org.apache.derby.impl.sql.compile.TableOperatorNode.bindResultColumns(TableOperatorNode.java:499)
      at org.apache.derby.impl.sql.compile.JoinNode.bindResultColumns(JoinNode.java:616)
      at org.apache.derby.impl.sql.compile.FromList.bindResultColumns(FromList.java:377)
      at org.apache.derby.impl.sql.compile.SelectNode.bindResultColumns(SelectNode.java:609)
      at org.apache.derby.impl.sql.compile.InsertNode.bindStatement(InsertNode.java:337)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
      at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConne
      ctionContext.java:746)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:129)
      ... 29 more
      ERROR 38000: The exception 'java.sql.SQLException: An ON clause associated with a JOIN operator is not valid.' was throw
      n while evaluating an expression.
      ERROR 42972: An ON clause associated with a JOIN operator is not valid.

      On trunk we get a different trace with a sane build:
      ava.sql.SQLException: Java exception: 'ASSERT FAILED col1.getClass() (class org.apache.derby.iapi.types.SQLInteger) exp
      ected to be the same as col2.getClass() (class org.apache.derby.iapi.types.SQLLongint): org.apache.derby.shared.common.s
      anity.AssertFailure'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
      at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
      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:1878)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1324)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1650)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:299)
      at SubShape.insert(SubShape.java:37)
      at org.apache.derby.exe.ac12564092x0117xf01cxf31fx00000011ade01.g0(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(ReflectMethod.java:46)
      at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(CallStatementResultSet.java:90)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:372)
      at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:159)
      at org.apache.derby.impl.sql.execute.StatementTriggerExecutor.fireTrigger(StatementTriggerExecutor.java:80)
      at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:269)
      at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1150)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:487)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:372)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1234)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:624)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:556)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:508)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main.main(Main.java:73)
      at org.apache.derby.tools.ij.main(ij.java:59)
      Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED col1.getClass() (class org.apache.derby.iapi.types.SQLI
      nteger) expected to be the same as col2.getClass() (class org.apache.derby.iapi.types.SQLLongint): org.apache.derby.shar
      ed.common.sanity.AssertFailure'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:13
      5)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
      ... 35 more
      Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED col1.getClass() (class org.apache.derby.ia
      pi.types.SQLInteger) expected to be the same as col2.getClass() (class org.apache.derby.iapi.types.SQLLongint)
      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:472)
      at org.apache.derby.impl.store.access.sort.MergeInserter.insert(MergeInserter.java:98)
      at org.apache.derby.impl.sql.execute.SortResultSet.loadSorter(SortResultSet.java:317)
      at org.apache.derby.impl.sql.execute.SortResultSet.openCore(SortResultSet.java:268)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.openCore(NormalizeResultSet.java:147)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:407)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:372)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1234)
      ... 28 more
      ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

        Issue Links

          Activity

          Hide
          Kathey Marsden added a comment -

          This issue was opened in error. It is a duplicate of DERBY-39.

          Show
          Kathey Marsden added a comment - This issue was opened in error. It is a duplicate of DERBY-39 .
          Hide
          Kathey Marsden added a comment -

          The assertion failure is likely the same as DERBY-3310

          Show
          Kathey Marsden added a comment - The assertion failure is likely the same as DERBY-3310
          Hide
          Kathey Marsden added a comment -

          You are right Army. The 'An ON clause associated with a JOIN operator is not valid.' error does not look like a regression after all and perhaps is the same as DERBY-39. The assertion failure started however with this change:

          ------------------------------------------------------------------------
          r554012 | djd | 2007-07-06 12:40:07 -0700 (Fri, 06 Jul 2007) | 4 lines

          DERBY-2775 (partial) Clarify some type handling for ResultColumn and its expression by making
          callers explictly get the expression's type from the expression, rather than having
          a method in ResultColumn that doesn't do what it indicates it did.
          Make VirtualColumnNode's type just refect its source node.
          ------------------------------------------------------------------------

          Now the question of what to do with this issue. I think perhaps I should change it to refer to the assertion failure and keep it as a regression affecting 10.4. Does that make sense?

          Show
          Kathey Marsden added a comment - You are right Army. The 'An ON clause associated with a JOIN operator is not valid.' error does not look like a regression after all and perhaps is the same as DERBY-39 . The assertion failure started however with this change: ------------------------------------------------------------------------ r554012 | djd | 2007-07-06 12:40:07 -0700 (Fri, 06 Jul 2007) | 4 lines DERBY-2775 (partial) Clarify some type handling for ResultColumn and its expression by making callers explictly get the expression's type from the expression, rather than having a method in ResultColumn that doesn't do what it indicates it did. Make VirtualColumnNode's type just refect its source node. ------------------------------------------------------------------------ Now the question of what to do with this issue. I think perhaps I should change it to refer to the assertion failure and keep it as a regression affecting 10.4. Does that make sense?
          Hide
          A B added a comment -

          Hi Kathey,

          I tried running the repro against a 10.2.2.0 set of jars (10.2.2.0 - (485682)) and the statement to create the trigger fails with a syntax error, as it did with 10.1:

          ij> CREATE TRIGGER "APP"."TR_SUBSHAPE_I3" AFTER INSERT ON "APP"."SUBSHAPE" FOR EACH STATEMENT CALL AP_SubShape_I();
          ERROR 42X01: Syntax error: Encountered "CALL" at line 1, column 91.

          Since the trigger is not created, the INSERT statement runs without error.

          If I run with 10.3.1.4, the trigger is created successfully, but then fails with the reported error. So I think this is a bug, but perhaps not a regression, since "CALL" inside a trigger was (apparently) not added until 10.3?

          Show
          A B added a comment - Hi Kathey, I tried running the repro against a 10.2.2.0 set of jars (10.2.2.0 - (485682)) and the statement to create the trigger fails with a syntax error, as it did with 10.1: ij> CREATE TRIGGER "APP"."TR_SUBSHAPE_I3" AFTER INSERT ON "APP"."SUBSHAPE" FOR EACH STATEMENT CALL AP_SubShape_I(); ERROR 42X01: Syntax error: Encountered "CALL" at line 1, column 91. Since the trigger is not created, the INSERT statement runs without error. If I run with 10.3.1.4, the trigger is created successfully, but then fails with the reported error. So I think this is a bug, but perhaps not a regression, since "CALL" inside a trigger was (apparently) not added until 10.3?
          Hide
          Kathey Marsden added a comment -

          This issue was originally posted as a repro for DERBY-39 but is a different issue since that was posted against 10.0 and this is a regression in 10.3

          Show
          Kathey Marsden added a comment - This issue was originally posted as a repro for DERBY-39 but is a different issue since that was posted against 10.0 and this is a regression in 10.3

            People

            • Assignee:
              Unassigned
              Reporter:
              Kathey Marsden
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development