Derby
  1. Derby
  2. DERBY-4693

column rename looses 'identity' attribute.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.3.1.4, 10.6.1.0
    • Fix Version/s: 10.6.2.1, 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Environment:
      ubuntu, java 1.5
    • Urgency:
      Normal
    • Issue & fix info:
      Newcomer, Repro attached

      Description

      renaming an identity column causes the column to loose its 'identity' attribute.

      you can reproduce the problem as follows:

      CREATE TABLE njr_version ( id INTEGER generated always as identity, databaseVersion INTEGER);

      insert into njr_version (databaseVersion) values (10);
      – column inserted successfully.
      rename column njr_version.id to idVersion;

      insert into njr_version (databaseVersion) values (10);
      Error: Column 'IDVERSION' cannot accept a NULL value.

      To compound this problem there is no way to restore the renamed column's identity attribute as the alter command doesn't let you set an identity attribute. The only work around is to create a new table and copy the data across.

      1. patch.diff
        5 kB
        Bryan Pendleton

        Activity

        Brett Sutton created issue -
        Brett Sutton made changes -
        Field Original Value New Value
        Description renaming an identity column causes the column to loose its 'identity' attribute.

        you can reproduce the problem as follows:

        CREATE TABLE njr_version ( id INTEGER generated always as identity, databaseVersion INTEGER);

        insert into njr_version (databaseVersion) values (10);
        -- column inserted successfully.
        rename column njr_version.id to idVersion;

        insert into njr_version (databaseVersion) values (10);
        Error: Column 'IDVERSION' cannot accept a NULL value.

        To compound this problem there is no way to restore the renamed columns identity attribute as the alter command doesn't let you set an identity attribute. The only work around is to create a new table and copy the data across.





        " (\n" + //$NON-NLS-1$
        " IDVERSION INTEGER generated always as identity,\n" +//$NON-NLS-1$
        " DATABASEVERSION INTEGER\n" + //$NON-NLS-1$
        " );
        renaming an identity column causes the column to loose its 'identity' attribute.

        you can reproduce the problem as follows:

        CREATE TABLE njr_version ( id INTEGER generated always as identity, databaseVersion INTEGER);

        insert into njr_version (databaseVersion) values (10);
        -- column inserted successfully.
        rename column njr_version.id to idVersion;

        insert into njr_version (databaseVersion) values (10);
        Error: Column 'IDVERSION' cannot accept a NULL value.

        To compound this problem there is no way to restore the renamed columns identity attribute as the alter command doesn't let you set an identity attribute. The only work around is to create a new table and copy the data across.
        Brett Sutton made changes -
        Description renaming an identity column causes the column to loose its 'identity' attribute.

        you can reproduce the problem as follows:

        CREATE TABLE njr_version ( id INTEGER generated always as identity, databaseVersion INTEGER);

        insert into njr_version (databaseVersion) values (10);
        -- column inserted successfully.
        rename column njr_version.id to idVersion;

        insert into njr_version (databaseVersion) values (10);
        Error: Column 'IDVERSION' cannot accept a NULL value.

        To compound this problem there is no way to restore the renamed columns identity attribute as the alter command doesn't let you set an identity attribute. The only work around is to create a new table and copy the data across.
        renaming an identity column causes the column to loose its 'identity' attribute.

        you can reproduce the problem as follows:

        CREATE TABLE njr_version ( id INTEGER generated always as identity, databaseVersion INTEGER);

        insert into njr_version (databaseVersion) values (10);
        -- column inserted successfully.
        rename column njr_version.id to idVersion;

        insert into njr_version (databaseVersion) values (10);
        Error: Column 'IDVERSION' cannot accept a NULL value.

        To compound this problem there is no way to restore the renamed column's identity attribute as the alter command doesn't let you set an identity attribute. The only work around is to create a new table and copy the data across.
        Knut Anders Hatlen made changes -
        Affects Version/s 10.3.1.4 [ 12312590 ]
        Fix Version/s 10.6.1.1 [ 12314973 ]
        Issue & fix info [Newcomer] [Newcomer, Repro attached]
        Bryan Pendleton made changes -
        Assignee Bryan Pendleton [ bryanpendleton ]
        Bryan Pendleton made changes -
        Attachment patch.diff [ 12446440 ]
        Bryan Pendleton made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 10.6.1.1 [ 12314973 ]
        Fix Version/s 10.7.0.0 [ 12314971 ]
        Resolution Fixed [ 1 ]
        Kathey Marsden made changes -
        Fix Version/s 10.6.2.0 [ 12315342 ]
        Fix Version/s 10.6.1.1 [ 12314973 ]
        Knut Anders Hatlen made changes -
        Fix Version/s 10.6.2.1 [ 12315343 ]
        Fix Version/s 10.6.2.0 [ 12315342 ]
        Rick Hillegas made changes -
        Fix Version/s 10.7.1.1 [ 12315564 ]
        Fix Version/s 10.7.1.0 [ 12314971 ]
        Knut Anders Hatlen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Gavin made changes -
        Workflow jira [ 12512630 ] Default workflow, editable Closed status [ 12802807 ]

          People

          • Assignee:
            Bryan Pendleton
            Reporter:
            Brett Sutton
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development