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 "Brett Sutton (JIRA)" <ji...@apache.org> on 2010/06/05 13:37:54 UTC

[jira] Updated: (DERBY-4693) column rename looses 'identity' attribute.

     [ https://issues.apache.org/jira/browse/DERBY-4693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Sutton updated DERBY-4693:
--------------------------------

    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.


  was:
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$
			"			);



> column rename looses 'identity' attribute.
> ------------------------------------------
>
>                 Key: DERBY-4693
>                 URL: https://issues.apache.org/jira/browse/DERBY-4693
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.1.0
>         Environment: ubuntu, java 1.5
>            Reporter: Brett Sutton
>            Priority: Minor
>             Fix For: 10.6.1.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.

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