[teiid-issues] [JBoss JIRA] (TEIID-5290) NOW() function returns the same value for each call in BEGIN...END block

Steven Hawkins (JIRA) issues at jboss.org
Tue Mar 20 11:50:00 EDT 2018


    [ https://issues.jboss.org/browse/TEIID-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13548629#comment-13548629 ] 

Steven Hawkins commented on TEIID-5290:
---------------------------------------

> But what about backward compatibility? 

The change to fully non-deterministic will alter the planning behavior for user queries and potentially lead to performance issues due to lack of evaluation and pushdown.

You are correct that in a stored procedure context you were relying on the non-deterministic implementation.

Unfortunately there isn't a great compromise nor does there seem to be consistency among vendors.  If we don't add a new function, then solutions would be:
1. add a switch to turn on the old function implementation
2. create a new determinism level between command and non-deterministic that goes down to the procedure statement level.

> NOW() function returns the same value for each call in BEGIN...END block
> ------------------------------------------------------------------------
>
>                 Key: TEIID-5290
>                 URL: https://issues.jboss.org/browse/TEIID-5290
>             Project: Teiid
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 10.1
>         Environment: teiid-10.1.0 on WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)
>            Reporter: dalex dalex
>            Assignee: Steven Hawkins
>             Fix For: 10.2
>
>
> Run the following queries:
> {code:sql}
> BEGIN
> 	declare timestamp ts1 = select now();
> 	DECLARE integer c = 20000;
> 	WHILE (c > 0) 
> 		BEGIN
> 			c= c-1; 
> 		END
> 	declare timestamp ts2 = select now();
> 	select ts1, ts2;
> END ;;
> {code}
> and
> {code:sql}
> BEGIN
> 	DECLARE integer c = 20000;
> 	create local temporary table #tem(ts timestamp);
> 	WHILE (c > 0) 
> 		BEGIN
> 			INSERT INTO #tem VALUES((select NOW()));
> 			c= c-1; 
> 		END 
> 	select * from #tem;
> END ;;
> {code}
> NOW() function returns the same value for each call in BEGIN...END block and it doesn't matter if it is atomic or not.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the teiid-issues mailing list