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
select avg(Null) from rdb$relations
select sum(Null) from rdb$relations
return
Unsuccessful execution caused by a system error that precludes
successful execution of subsequent statements.
Dynamic SQL Error.
expression evaluation not supported
This is really funny case:
SQL> select avg(null) from rdb$relations;
Statement failed, SQLCODE = -902
Dynamic SQL Error
-expression evaluation not supported
SQL> select sum(null) from rdb$relations;
Statement failed, SQLCODE = -902
Dynamic SQL Error
-expression evaluation not supported
You don't need to have a dialect 1 db. You only need to change the connection dialect to be 1:
SQL> set sql dialect 1;
WARNING: Client SQL dialect has been set to 1 when connecting to Database SQL dialect 3 database.
SQL> select sum(null) from rdb$relations;
While reviewing this ticket, I have one doubt. We describe the NULL literal as CHAR(1). Some arithmetical expressions change the datatype to something more appropriate, e.g. NULL + NULL = NULL as INT. MIN/MAX accept string inputs so MIN(NULL) = NULL as CHAR(1). But what AVG/SUM should return in this case? In usual conditions, they cannot return string data, so returning CHAR(1) looks a bit weird. Should the result be INT? Or maybe DOUBLE PRECISION?
Submitted by: Kuznetsov Eugene (eugene)
Is related to QA537
For any 3-dialect base
select avg(Null) from rdb$relations
select sum(Null) from rdb$relations
return
Unsuccessful execution caused by a system error that precludes
successful execution of subsequent statements.
Dynamic SQL Error.
expression evaluation not supported
while it works fine for 1-dialect base
Best regards, Eugene
Commits: 5b0b907
====== Test Details ======
Checked: avg(null),sum(null);
New statistical functions in 3.0:
var_samp(null),var_pop(null)
,stddev_samp(null),stddev_pop(null)
,covar_samp(null, null),covar_pop(null, null)
,corr(null, null)
The text was updated successfully, but these errors were encountered: