Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

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

Merged
merged 1 commit into from
Sep 2, 2016

Conversation

moscowgentalman
Copy link
Contributor

@moscowgentalman moscowgentalman commented Sep 2, 2016

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.

@Traf-Jenkins
Copy link

Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/1109/

@Traf-Jenkins
Copy link

@anoopsharma00
Copy link
Contributor

Good fix.

@asfgit asfgit merged commit 8d75967 into apache:master Sep 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants