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

FB3 vs FB2.5. Different metadata for UDF return argument [CORE4237] #4561

Closed
firebird-issue-importer opened this issue Sep 23, 2013 · 13 comments

Comments

@firebird-issue-importer

Submitted by: @ibprovider

[TEST UDF]
DECLARE EXTERNAL FUNCTION UDF_TEST2 RETURNS BLOB ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

+++++++++++++++++++++++++++++++++++++++++++++++
[FB2.5]
ISQL> show function UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Returns BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
...
RDB$RETURN_ARGUMENT: 1
...
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 8
...

+++++++++++++++++++++++++++++++++++++++++++++++
[FB3]
ISQL> show FUNCTION UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Argument 0: BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
....
RDB$RETURN_ARGUMENT: 1
....

-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 0 //<-------------- !!!
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 0 //<-------------- !!!

+++++++++++++++++++++++++++++++++++++++++++++++
It seems that FB3 works incorrectly.

Commits: 5296e61 56c2a5f FirebirdSQL/fbt-repository@c8ae900 FirebirdSQL/fbt-repository@a0c263c

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 3, 2013

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 3, 2013

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 2 [ 10560 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 3, 2013

Commented by: @ibprovider

Hi

At first look - all is ok.

Thanks.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: @ibprovider

Hi

[Test UDF]
DECLARE EXTERNAL FUNCTION UDF_DUMMY2_BD__BLOB BLOB BY DESCRIPTOR RETURNS BLOB BY DESCRIPTOR ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

Different "RDB$MECHANISM" for argument #⁠2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[FB 2.5.3.26708]
SQL> show function UDF_DUMMY2_BD__BLOB;

Function UDF_DUMMY2_BD__BLOB:
Function library is ib_udf
Entry point is IB_UDF_abs
Argument 1: BY DESCRIPTOR BLOB
Returns BLOB <------------------- !!!

select * from rdb$functions x where x.rdb$function_name='UDF_DUMMY2_BD__BLOB'
...
RDB$RETURN_ARGUMENT: 2
...
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_DUMMY2_BD__BLOB'
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__BLOB
RDB$ARGUMENT_POSITION: 2
RDB$MECHANISM: 3 <------------------- !!!
...
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__BLOB
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 2
...

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[FB 3.0.0.30676]

SQL> show function UDF_DUMMY2_BD__BLOB;

External function UDF_DUMMY2_BD__BLOB:
Function library is ib_udf
Entry point is IB_UDF_abs
Argument 1: BY DESCRIPTOR BLOB
Returns BY DESCRIPTOR BLOB <------------------- !!!
...
RDB$RETURN_ARGUMENT: 2
...
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_DUMMY2_BD__BLOB'
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__BLOB
RDB$ARGUMENT_POSITION: 2
RDB$MECHANISM: 2 <------------------- !!!
...
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__BLOB
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 2
...

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

If this is real problem, please, reopen this ticket.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: @ibprovider

Although, seems (in second case with UDF_DUMMY2_BD__BLOB) the problem present in FB2.5 and in FB3.0 :)

Example for other UDF:

DECLARE EXTERNAL FUNCTION UDF_DUMMY2_BD__VCH32BIG5
VARCHAR(32) CHARACTER SET BIG_5 BY DESCRIPTOR
RETURNS VARCHAR(32) CHARACTER SET BIG_5 BY DESCRIPTOR <------------- !!!
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

Note to number of return argument. Now is 0, not 2 (as in UDF_DUMMY2_BD__BLOB).

[FB 2.5.3.26708] +++++++++++++++++++++++++++++++++++++++++++++++++++++++

select * from rdb$functions x where x.rdb$function_name='UDF_DUMMY2_BD__VCH32BIG5'
...
RDB$RETURN_ARGUMENT: 0 <------------------------------ !!!!
...

-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_DUMMY2_BD__VCH32BIG5'
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__VCH32BIG5
RDB$ARGUMENT_POSITION: 0 <------------------------------ !!!!
RDB$MECHANISM: 2
...
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__VCH32BIG5
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 2
...

[FB 3.0.0.30676] ++++++++++++++++++++++++++++++++++++++++++++++

select * from rdb$functions x where x.rdb$function_name='UDF_DUMMY2_BD__VCH32BIG5'
...
RDB$RETURN_ARGUMENT: 0 <----------------------- !!!
...

-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_DUMMY2_BD__VCH32BIG5'
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__VCH32BIG5
RDB$ARGUMENT_POSITION: 0 <----------------------- !!!
RDB$MECHANISM: 2
...
RDB$FUNCTION_NAME: UDF_DUMMY2_BD__VCH32BIG5
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 2
...

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: Sean Leyne (seanleyne)

Dmitry,

Can we edit the details of the case to focus on the key issue/differences?

There are a lot of details which are not required to highlight/show the problem.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: @ibprovider

>Can we edit the details of the case to focus on the key issue/differences?

Yes, of course.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: @asfernandes

Commited a fix for the "Different RDB$MECHANISM for argument #⁠2" case.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: Sean Leyne (seanleyne)

By "we" I meant you. ;-]

I can edit the item, but you may not like how much I trim from the details.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Modified by: @ibprovider

description: [TEST UDF]
DECLARE EXTERNAL FUNCTION UDF_TEST2 RETURNS BLOB ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

+++++++++++++++++++++++++++++++++++++++++++++++
[FB2.5]
ISQL> show function UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Returns BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$FUNCTION_TYPE: <null>
RDB$QUERY_NAME: <null>
RDB$DESCRIPTION: <null>
RDB$MODULE_NAME: ib_udf
RDB$ENTRYPOINT: IB_UDF_abs
RDB$RETURN_ARGUMENT: 1
RDB$SYSTEM_FLAG: 0
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 8
RDB$FIELD_SUB_TYPE: 0
RDB$CHARACTER_SET_ID: <null>
RDB$FIELD_PRECISION: <null>
RDB$CHARACTER_LENGTH: <null>

+++++++++++++++++++++++++++++++++++++++++++++++
[FB3]
ISQL> show FUNCTION UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Argument 0: BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$FUNCTION_TYPE: <null>
RDB$QUERY_NAME: <null>
RDB$DESCRIPTION: <null>
RDB$MODULE_NAME: ib_udf
RDB$ENTRYPOINT: IB_UDF_abs
RDB$RETURN_ARGUMENT: 1
RDB$SYSTEM_FLAG: 0
RDB$ENGINE_NAME: <null>
RDB$PACKAGE_NAME: <null>
RDB$PRIVATE_FLAG: <null>
RDB$FUNCTION_SOURCE: <null>
RDB$FUNCTION_ID: 2749
RDB$FUNCTION_BLR: <null>
RDB$VALID_BLR: 1
RDB$DEBUG_INFO: <null>
RDB$SECURITY_CLASS: SQL$11302
RDB$OWNER_NAME: GAMER
RDB$LEGACY_FLAG: 1
RDB$DETERMINISTIC_FLAG: 0
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 0 //<-------------- !!!
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 0 //<-------------- !!!
RDB$FIELD_SUB_TYPE: 0
RDB$CHARACTER_SET_ID: <null>
RDB$FIELD_PRECISION: <null>
RDB$CHARACTER_LENGTH: <null>
RDB$PACKAGE_NAME: <null>
RDB$ARGUMENT_NAME: <null>
RDB$FIELD_SOURCE: <null>
RDB$DEFAULT_VALUE: <null>
RDB$DEFAULT_SOURCE: <null>
RDB$COLLATION_ID: <null>
RDB$NULL_FLAG: <null>
RDB$ARGUMENT_MECHANISM: 0
RDB$FIELD_NAME: <null>
RDB$RELATION_NAME: <null>
RDB$SYSTEM_FLAG: 0
RDB$DESCRIPTION: <null>

+++++++++++++++++++++++++++++++++++++++++++++++
It seems that FB3 works incorrectly.

=>

[TEST UDF]
DECLARE EXTERNAL FUNCTION UDF_TEST2 RETURNS BLOB ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

+++++++++++++++++++++++++++++++++++++++++++++++
[FB2.5]
ISQL> show function UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Returns BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
...
RDB$RETURN_ARGUMENT: 1
...
-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 1
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 8
...

+++++++++++++++++++++++++++++++++++++++++++++++
[FB3]
ISQL> show FUNCTION UDF_TEST2;

Function UDF_TEST2:
Function library is ib_udf
Entry point is IB_UDF_abs
Argument 0: BLOB

-----------
select * from rdb$functions x where x.rdb$function_name='UDF_TEST2'
....
RDB$RETURN_ARGUMENT: 1
....

-----------
select * from rdb$function_arguments x where x.rdb$function_name='UDF_TEST2'
RDB$FUNCTION_NAME: UDF_TEST2
RDB$ARGUMENT_POSITION: 0 //<-------------- !!!
RDB$MECHANISM: 3
RDB$FIELD_TYPE: 261
RDB$FIELD_SCALE: 0
RDB$FIELD_LENGTH: 0 //<-------------- !!!

+++++++++++++++++++++++++++++++++++++++++++++++
It seems that FB3 works incorrectly.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Oct 4, 2013

Commented by: @ibprovider

FB 3.0.0.30680

Now all is ok.

Thanks.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 27, 2014

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 18, 2016

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants