Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6882

Add functionality to ALTER TABLE: switch from GENERATED ALWAYS to GENERATED BY DEFAULT

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 10.12.1.1
    • 10.12.1.2, 10.13.1.0
    • SQL

    Description

      I'm trying to import data from another Derby database with foreignViews tool because system tables got corrupted somehow (see https://issues.apache.org/jira/browse/DERBY-6876). Tables contain generated ID columns (created as "GENERATED ALWAYS"). Importing data and allowing Derby to generate new IDs in generated columns will break relationships between tables (old tables have counter gaps there due to deletes - IDs won't match).
      For a clean import without breaking DDL information in DB version control I would like to be able to switch between generated types as follows:

      ALTER TABLE table1 ALTER COLUMN col1 SET GENERATED BY DEFAULT [ AS IDENTITY]
      ALTER TABLE table1 ALTER COLUMN col1 SET GENERATED ALWAYS [ AS IDENTITY]

      Attachments

        1. derby-6882-01-aa-initialCode.diff
          11 kB
          Richard N. Hillegas
        2. derby-6882-01-bb-withTests.diff
          38 kB
          Richard N. Hillegas
        3. derby-6882-02-aa-port_1738368_to_10.12.diff
          32 kB
          Richard N. Hillegas

        Issue Links

          Activity

            People

              rhillegas Richard N. Hillegas
              Alex K. Aleksei Kovura
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: