Derby
  1. Derby
  2. DERBY-4803

Sequences do not work in INSERT/SELECT

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Environment:
      Mac OS X, Derby Network Server 10.6.1.0
    • Urgency:
      Normal
    • Issue & fix info:
      Repro attached

      Description

      Using sequence in SELECT works fine whereas the same SELECT query used in INSERT/SELECT results in "The statement references the following sequence more than once" error. This happens even though the SELECT in question returns exactly 1 row of data.

      The Reference Manual states 1. " NEXT VALUE FOR expression may occur in the following places: SELECT statement: As part of the expression defining a returned column in a SELECT list" and 2. " NEXT VALUE expression may not appear in any of these situations: CASE expression, WHERE clause,
      ORDER BY clause, Aggregate expression, ROW_NUMBER function, DISTINCT select list".
      Nowhere a restriction on INSERT/SELECT is mentioned. Additionally, other databases (i.e. Oracle) support use of sequences in INSERT/SELECT.

      Therefore, I consider it a bug.

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12520720 ] Default workflow, editable Closed status [ 12802824 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rick Hillegas made changes -
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Rick Hillegas made changes -
          Issue & fix info [Repro attached, Patch Available] [Repro attached]
          Rick Hillegas made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Resolution Fixed [ 1 ]
          DK made changes -
          Attachment DerbyTestCase.sql [ 12455214 ]
          Rick Hillegas made changes -
          Link This issue is related to DERBY-4513 [ DERBY-4513 ]
          Rick Hillegas made changes -
          Assignee Rick Hillegas [ rhillegas ]
          Rick Hillegas made changes -
          Issue & fix info [Patch Available, Repro attached]
          Rick Hillegas made changes -
          Field Original Value New Value
          Attachment derby-4803-01-aa-simpleInsertSelect.diff [ 12455174 ]
          DK created issue -

            People

            • Assignee:
              Rick Hillegas
              Reporter:
              DK
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development