[ 
http://issues.apache.org/jira/browse/DERBY-275?page=comments#action_12314405 ] 

Kathey Marsden commented on DERBY-275:
--------------------------------------

REGARDING THIS PARAGRAPH:

Note that unlike a GENERATED ALWAYS column, a GENERATED BY DEFAULT column does 
not guarantee uniqueness. Thus, in the above example, the hi and salut rows 
will both have an identity value of "1", because the generated column starts at 
"1" and the user-specified value was also "1". To prevent this, you can use the 
"STARTS WITH" keyword described below. To check for this condition and disallow 
it, you can use a primary key or unique constraint on the GENERATED BY DEFAULT 
identity column.

In the paragraph STARTS WITH should be START WITH and loading or importing data 
should be covered.

CHANGE:
To prevent this, you can use the "STARTS WITH" keyword described below. 

TO:

To prevent  duplication especially when loading or importing data, create the 
table using  a "START WITH" value which corresponds to the first 
identity value that the system should assign.

ADD AN EXAMPLE:

create table greetings
        (i int generated by default as identity (START WITH 2, INCREMENT BY 1),
 ch char(50));
-- specify value "1":
insert into greetings values (1, 'hi');
-- use generated default
insert into greetings values (DEFAULT, 'salut');
-- use generated default
insert into greetings(ch) values ('bonjour');



> Add documentation support for BY DEFAULT option, once code changes are made.
> ----------------------------------------------------------------------------
>
>          Key: DERBY-275
>          URL: http://issues.apache.org/jira/browse/DERBY-275
>      Project: Derby
>         Type: Sub-task
>   Components: Documentation
>     Versions: 10.0.2.1
>     Reporter: Satheesh Bandaram
>      Fix For: 10.1.1.0
>  Attachments: derby275finaldraftmodified.zip
>
> Once a patch is accepted, new syntax needs to be documented.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to