firebird icon indicating copy to clipboard operation
firebird copied to clipboard

[FB4] Proposal for fixing #7877 - disable an usage of SCALAR_ARRAY with BLOB datatype

Open dmitry-lipetsk opened this issue 2 years ago • 1 comments

Additional change - the check of usage BY SCALAR_ARRAY with return parameter was moved from CreateAlterFunctionNode::executeAlter (execute stage) in CreateAlterFunctionNode::dsqlPass (prepare stage).

Test with ISQL:

DECLARE EXTERNAL FUNCTION UDF_DUMMY2_BSA__BLOB2
BLOB BY SCALAR_ARRAY
RETURNS BLOB BY DESCRIPTOR
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

Statement failed, SQLSTATE = 42000 CREATE FUNCTION UDF_DUMMY2_BSA__BLOB2 failed -SQL error code = -607 -Invalid command -BY SCALAR_ARRAY can't be used with BLOB datatype

DECLARE EXTERNAL FUNCTION UDF_DUMMY2_BSA__BLOB3
integer BY SCALAR_ARRAY,
BLOB BY SCALAR_ARRAY
RETURNS PARAMETER 2
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

Statement failed, SQLSTATE = 42000 CREATE FUNCTION UDF_DUMMY2_BSA__BLOB3 failed -SQL error code = -607 -Invalid command -BY SCALAR_ARRAY can't be used as a return parameter


Note: new code uses the following operator: https://github.com/FirebirdSQL/firebird/blob/255fc240991b45e8d36064225cc51076112f14f5/src/common/classes/Nullable.h#L73-L76

dmitry-lipetsk avatar Nov 26 '23 19:11 dmitry-lipetsk

It seems to me this PR has the problem.

I should check udfReturnPos in dsqlPass, too.

dmitry-lipetsk avatar Nov 26 '23 19:11 dmitry-lipetsk