You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
summary: not correct result function LAG, if the value OFFSET values are assigned from a table => not correct result function LAG, if OFFSET value are assigned from a table
Submitted by: @sim1984
Is related to QA590
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
Commits: 49fa42f FirebirdSQL/fbt-repository@1f36b5e
The text was updated successfully, but these errors were encountered: