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 "Suran Jayathilaka (JIRA)" <ji...@apache.org> on 2009/11/06 21:51:32 UTC

[jira] Commented: (DERBY-712) Support for sequences

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

Suran Jayathilaka commented on DERBY-712:
-----------------------------------------

Sequence NEXT VALUE implementation work Q & A: 
Thanks to Rick Hillegas for answers.

1. How does escapedValueFunction work in valueExpressionPrimary?
If you run the "javadoc" ant target, you can browse a nice summary of the grammar in
 javadoc/language/sqlgrammar.html
There you will see that escapedValueFunction covers invocations of Derby-supplied functions. These can be aliased as JDBC escaped functions. These in turn are functions whose api the JDBC spec tries to standardize--most databases support these functions but the SQL committee never got around to standardizing the apis.

2. In fact, what is the purpose of the valueExpressionPrimary() method?
In general, the Derby grammar does a pretty good job of following the grammar laid out in part 2 of the SQL Standard. In this case, valueExpressionPrimary() is trying to model the <value expression primary> clause in section 6.3 of the Standard (you can find the Standard here: http://www.wiscorp.com/SQLStandards.html )

3. How can I add NextSequenceNode as an option here?
As you can see from the Standard grammar, <next value expression> is a kind of <value expression primary> and lives in the grammar parallel to <column reference> and <cast specification>. So I would recommend adding nextValueExpression() as another option inside valueExpressionPrimary().

> Support for sequences
> ---------------------
>
>                 Key: DERBY-712
>                 URL: https://issues.apache.org/jira/browse/DERBY-712
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>         Environment: feature request 
>            Reporter: Tony Dahbura
>            Assignee: Suran Jayathilaka
>             Fix For: 10.6.0.0
>
>         Attachments: altertable.diff, catalogs_a.patch, catalogs_b.patch, catalogs_c.patch, catalogs_d.patch, catalogs_e.patch, catalogs_f.patch, catalogs_f_2.patch, catalogs_g.diff, catalogs_h.diff, create_drop_sequence_a.patch, create_drop_sequence_b.patch, create_drop_sequence_c.patch, create_drop_sequence_d.patch, create_sequence_a.patch, SequenceGenerator.html
>
>
> Would like to see support added for sequences.  This would permit a select against the sequence to always obtain a ever increasing/decreasing value.  The identity column works fine but there are times for applications where the application needs to obtain the sequence number and use it prior to the database write.  Subsequent calls to the table/column would result in a new number on each call.
> SQL such as the following:
> SELECT NEXT VALUE FOR sequence_name FROM sometable ; would result in a next value.

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