phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Di Spaltro <dan.dispal...@gmail.com>
Subject Re: Selecting from a sequence
Date Wed, 09 Apr 2014 05:50:09 GMT
Thanks good idea with using the system table.  Regarding your first
suggestion James, It's pretty hard to use that when it's basically
impossible to get the autogenerated value back, that was alluded to in a
previous thread. Is there a ticket open for this already, I couldn't find
anything.

Thanks,

-Dan


On Tue, Apr 8, 2014 at 10:27 PM, James Taylor <jamestaylor@apache.org>wrote:

> We should support statements without any FROM clause for cases like this.
> That way you could do something like this:
> {code}
> SELECT NEXT VALUE FOR my_seq;
> {code}
> In the meantime, there are a couple of workarounds:
> - do the NEXT VALUE FOR in the UPSERT statement, as this is the most
> common use case
> - use a table where you know there will be rows, like the SYSTEM.SEQUENCE
> table or the SYSTEM.CATALOG table. Best to put a LIMIT clause on your
> SELECT so you don't select the entire table each time.
>
> Thanks,
> James
>
>
>
> On Tue, Apr 8, 2014 at 6:26 PM, Dan Di Spaltro <dan.dispaltro@gmail.com>wrote:
>
>> So I created a new table and sequence.  My typical pattern for that is
>> selecting from the sequence using a table, but I noticed if the table is
>> empty it doesn't select anything.  While in practice this won't really be a
>> problem but it's a pain when testing, is this intended behavior?
>>
>> Thanks!
>>
>> -Dan
>>
>> --
>> Dan Di Spaltro
>>
>
>


-- 
Dan Di Spaltro

Mime
View raw message