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

Rick Hillegas commented on DERBY-712:
-------------------------------------

Hi Suran,

Thanks for the patch. Here are some answers to your question:

1) You don't need to add the permissions check which you saw in CREATE ROLE. 
The only permission you need to worry about is the permission to create objects 
in the target schema. I address that topic below.

2) The bind() logic is responsible for filling in the current schema name if 
the user doesn't specify a schema. I address that topic below too.

Here is a quick review of CreateSequenceNode:

- I don't understand why initAndCheck() is called twice. I think that all you 
need is the call which takes sequenceName as arg. But let me know your 
motivation for adding this line if you think it is necessary.

- The header comment of bindStatement() should be revised. The main points of 
this method are to resolve the schema name, determine privilege checks, and vet 
the variables in the CREATE SEQUENCE statement.

- In bindStatement() you will want to resolve the schema name. Something like 
the following should do the trick. This will verify that the schema name is 
valid (if specified) and if the schema name is not specified, this will fill in 
the name of the session's current schema:

  sequenceName.bind( getDataDictionary() );

- If you add the following code to bindStatement() (after you have bound the 
schema name), then a runtime check will be made to verify that the creator has 
permission to create objects in the target schema:

  SchemaDescriptor sd = getSchemaDescriptor();

Thanks!
-Rick

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

Reply via email to