GitHub user traflm opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/687

    [TRAFODION-2202] in mode_special_4, sequence function is broken

    when CQD mode_special_4 is 'on', the binder try to support Oracle sequence 
syntax as 'indentifier.nextval'.
    Binder will regard the identifier as a sequence object which object_type is 
'SG'.
    However, the sequence execution code will try to get the current value via 
such a query in SeqGenCliInterfaceUpdAndValidate():
     "select  case when cast(? as largeint not null) = 1 then t.startVal else 
t.nextVal end, t.redefTS from (update %s.\"%s\".%s set next_value = (case when 
cast(? as largeint not null) = 1 then start_value + cast(? as largeint not 
null) else (case when next_value + cast(? as largeint not null) > max_value 
then max_value+1 else next_value + cast(? as largeint not null) end) end), 
num_calls = num_calls + 1 where seq_uid = %Ld return old.start_value, 
old.next_value, old.redef_ts) t(startVal, nextVal, redefTS);",
    
    so the t.nextval will be handled special, try to find SG object for object 
'T', which cannot find, so trigger issues.
    
    This change is very simple, to change the nextval into some other string: 
'nextvalue', so the binder will NOT try to treat it as a Oracle syntax.
    
    So when mode_special_4 is 'ON', one can still use the normal sequence 
function.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/traflm/incubator-trafodion TRAFODION-2202

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/687.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #687
    
----
commit 8d75967c8bbb123f9c87718528c18d6a21143742
Author: Liu Ming <ovis_p...@sina.com>
Date:   2016-09-02T14:10:31Z

    [TRAFODION-2202] in mode_special_4, sequence function is broken

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to