phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Taylor <jamestay...@apache.org>
Subject Re: Selecting from a sequence
Date Wed, 09 Apr 2014 05:27:01 GMT
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
>

Mime
View raw message