Parameter in offset expression in LAG, LEAD, NTH_VALUE window functions 
requires explicit cast to BIGINT or INTEGER
-------------------------------------------------------------------------------------------------------------------

                 Key: CORE-6421
                 URL: http://tracker.firebirdsql.org/browse/CORE-6421
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0.6, 4.0 Beta 2, 3.0.5, 4.0 Beta 1, 3.0.4, 3.0.3, 4.0 
Alpha 1, 3.0.2, 3.0.1, 3.0.0
         Environment: Firebird-4.0.0.2228-0_x64 on Windows 10
Firebird-3.0.5.33220-0_x64 on Windows 10
            Reporter: Mark Rotteveel


When using a parameter in LAG, LEAD or NTH_VALUE window functions, Firebird 
returns the error "Dynamic SQL Error; SQL error code = -804; Data type unknown 
[SQLState:HY004, ISC error code:335544573]"

For example:
select rdb$relation_name, lag(rdb$relation_name, ?) over (order by 
rdb$relation_name) from rdb$relations

The workaround is to add an explicit cast:
select rdb$relation_name, lag(rdb$relation_name, cast(? as bigint)) over (order 
by rdb$relation_name) from rdb$relations

The same applies to LEAD and NTH_VALUE.

Firebird should identify the parameter as BIGINT.

-- 
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

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to