You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Alex Warshavsky (JIRA)" <ji...@apache.org> on 2014/09/03 20:08:51 UTC

[jira] [Commented] (PHOENIX-922) Select a sequence without a from clause

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

Alex Warshavsky commented on PHOENIX-922:
-----------------------------------------

Another improvement would be to allow getting a number of sequences based on a parameter rather than number of rows. This might require a function rather than simple select statement. E.g. in postgress, there's a nextval() function. http://www.postgresql.org/docs/8.1/static/functions-sequence.html

Phoenix could have an implementation of nextval(<sequenceName>, [numValues]), 

where numValues is an optional parameter (defaulting to 1) which specifies how many sequences to return.

SELECT nextval('mysequece', 5) for a sequence with default attributes would return

1
2
3
4
5

> Select a sequence without a from clause
> ---------------------------------------
>
>                 Key: PHOENIX-922
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-922
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Dan Di Spaltro
>
> You should be able to select any "generator" type function from Phoenix without specifying a table.  For instance a sequence needs an arbitrary potentially unrelated table just to get the next value.  The fix should enable queries like this:
> {code}
> SELECT NEXT VALUE FOR my_seq
> {code}



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