Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: v4.0-release
Choose a base branch
from

Conversation

dmitry-lipetsk
Copy link
Contributor

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:

bool operator ==(const T& o) const
{
return specified && value == o;
}

…AY with BLOB datatype

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
@dmitry-lipetsk
Copy link
Contributor Author

It seems to me this PR has the problem.

I should check udfReturnPos in dsqlPass, too.

The check of udfReturnPos was moved from CreateAlterFunctionNode::executeAlter in CreateAlterFunctionNode::dsqlPass

Tests:

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

Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -842
-Positive value expected
-At line 4, column 19

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

Statement failed, SQLSTATE = 38000
CREATE FUNCTION UDF_DUMMY2_BSA__BLOB3 failed
-SQL error code = -607
-Invalid command
-External function should have return position between 1 and 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant