db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Suran Jayathilaka (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-712) Support for sequences
Date Sun, 09 Aug 2009 21:10:15 GMT

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

Suran Jayathilaka updated DERBY-712:
------------------------------------

    Attachment: create_sequence_a.patch

Attaching initial (incomplete) draft of the create sequences patch for review. Tests were
not run with this patch.

A couple of questions:
1. 
Is it necessary to require a PRIVILEGE in CreateSequenceNode.bindStatement(), like done in
CreateRoleNode (below)?
----------------
if (isPrivilegeCollectionRequired()) {
            cc.addRequiredRolePriv(name, Authorizer.CREATE_ROLE_PRIV);
        }
----------------
 
If yes, do I use the MODIFY_SCHEMA_PRIV or define new ones as CREATE_SEQUENCE_PRIV ?

2. 
In the very basic testcase I've added I attempt to execute a Create Sequence statement without
specifying a schema. This fails saying the schema name is null. Why isn't the default schema
being picked up?

-------------
Also adding here with thanks, a question answered by Rick Hillegas.

Q: What's the method to get the schema name in sqlgrammar.jj?

A:
The data structure you are looking for is called TableName. It contains a schema name and
an object name within that schema. The bind() phase of compilation knows how to fill in the
default schema name if the user doesn't supply an explicit schema name. For an example of
how to use TableName, see sqlgrammar.functionDefinition(). Your code will end up looking something
like this:

StatementNode
sequenceDefinition() throws StandardException :
{
  TableName qualifiedName = null;
}
{       <SEQUENCE> qualifiedName = qualifiedName(Limits.MAX_IDENTIFIER_LENGTH)



> 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_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.


Mime
View raw message