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 "Rick Hillegas (JIRA)" <ji...@apache.org> on 2015/11/26 21:16:10 UTC

[jira] [Commented] (DERBY-6843) Altering the Identity columns rules

    [ https://issues.apache.org/jira/browse/DERBY-6843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029229#comment-15029229 ] 

Rick Hillegas commented on DERBY-6843:
--------------------------------------

Hi Anjana,

You could get part of the way to your goal by making the following alterations after loading the table:

1) Add a CHECK NOT NULL constraint to the identity column. That will prevent someone from inserting a tuple with no identity value.

2) You can add an UPDATE trigger which raises an error if someone tries to change the identity value on an existing row.

Hope this helps,
-Rick

> Altering the Identity columns rules 
> ------------------------------------
>
>                 Key: DERBY-6843
>                 URL: https://issues.apache.org/jira/browse/DERBY-6843
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 10.11.1.1, 10.12.1.1
>         Environment: CENTOS
>            Reporter: Anjana
>
> We do export of from one derby database to another. Our database defined identity type as ''GENERATED ALWAYS" Due to which the import does not consider the identity column value from the export file. 
> Our requirement is to import those identity column values as well. 
> As per understanding one of the option in derby is to create table with identity type as "GENERATED BY DEFAULT" . However need to understand if there is alternative in derby where in we can modify the identity type before import to ''GENERATED by DEFAULT" and then after import is successfully change it back to "GENERATED ALWAYS". 
> Appreciate if any one can guide on same. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)