db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4513) Forbid NEXT VALUE FOR clause in certain contexts
Date Wed, 13 Jan 2010 13:18:54 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799731#action_12799731

Knut Anders Hatlen commented on DERBY-4513:

Thanks for clarifying, Rick.

So both of these (presumably SQL compliant) statements will be rejected?

  SELECT NEXT VALUE FOR S, NEXT VALUE FOR S FROM T  -- two clauses per row

  VALUES (NEXT VALUE FOR S), (NEXT VALUE FOR S) -- two clauses in the statement, but only
one per row

The VALUES case is probably more useful than the SELECT case, especially as part of an INSERT
statement. The restriction would basically prevent us from using a sequence generator in a
multi-row insert. That's probably fine in the initial implementation, though, and anyone could
scratch that itch later if they want to.

> Forbid NEXT VALUE FOR clause in certain contexts
> ------------------------------------------------
>                 Key: DERBY-4513
>                 URL: https://issues.apache.org/jira/browse/DERBY-4513
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Rick Hillegas
> This is part of the work needed to implement ANSI/ISO sequences. The functional spec
attached to DERBY-712 lists various situations in which the NEXT VALUE FOR clause is illegal.
These include:
>     * CASE expression
>     * WHERE clause
>     * ORDER BY clause
>     * AGGREGATE expression
>     * WINDOW function
>     * DISTINCT select list
> In addition, I propose that we make it illegal for a statement to have more than one
NEXT VALUE FOR clause on the same sequence generator. This is a tighter restriction than the
ANSI/ISO standard calls for. The standard requires that if two columns in a row are populated
by NEXT VALUE FOR clauses on the same sequence, then the values should be the same. I don't
feel confident that I could track down all of the cases which could give rise to this situation--so
I propose to limit the number of NEXT VALUE FOR clauses on a given sequence generator to just

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message