not correct result function LAG, if the value OFFSET values ​​are assigned from 
a table
---------------------------------------------------------------------------------------

                 Key: CORE-4330
                 URL: http://tracker.firebirdsql.org/browse/CORE-4330
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0 Alpha 2
            Reporter: Simonov Denis


with t(a, b) as
(
  select 1, null from rdb$database
  union all
  select 2, 1 from rdb$database 
  union all
  select 3, 2 from rdb$database 
  union all
  select 4, 3 from rdb$database 
  union all
  select 5, 2 from rdb$database   
)
select
  a,
  b,
  lag(a, b) over(order by a) as la
from t

A       B       LA
1               
2       1                                 <-- incorrect
3       2                                 <-- incorrect
4       3       2                       <-- incorrect
5       2       3

PostgreSQL return correct result

with t(a, b) as
(
  select 1, null 
  union all
  select 2, 1 
  union all
  select 3, 2 
  union all
  select 4, 3 
  union all
  select 5, 2   
)
select
  a,
  b,
  lag(a, b) over(order by a) as la
from t

A       B       LA
1               
2       1       1
3       2       1
4       3       1
5       2       3


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to