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

fbudf functions make invalid blr [CORE5504] #5773

Closed
firebird-automations opened this issue Mar 16, 2017 · 3 comments
Closed

fbudf functions make invalid blr [CORE5504] #5773

firebird-automations opened this issue Mar 16, 2017 · 3 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: christophe derenne (cdr60530)

With a fresh firebird-superserver 2.5.7 installation
create a new database
for example
/var/lib/firebird/data/test.fdb
with sqldialect 3, charset UTF-8

crate a very simple table :
create table tbtest (idtest integer not null);

Make some row (for exemple 10 rows from idtest=1 to idtest=10)

insert into tbtest (idtest)
values
(1);
insert into tbtest (idtest)
values
(2);
insert into tbtest (idtest)
values
(3);
insert into tbtest (idtest)
values
(4);
insert into tbtest (idtest)
values
(5);
insert into tbtest (idtest)
values
(6);
insert into tbtest (idtest)
values
(7);
insert into tbtest (idtest)
values
(8);
insert into tbtest (idtest)
values
(9);
insert into tbtest (idtest)
values
(10);

register a fbudf function :
fo exemple :
declare external function ADDDAY
timestamp, int
returns timestamp
entry_point 'addday' module_name 'fbudf';

declare external function ADDDAY2
timestamp, int
returns timestamp
entry_point 'addDay' module_name 'fbudf';

Use thoses functions

select 100*a.idtest+10*b.idtest+c.idtest, addDay(cast('2001-01-01' as timestamp),100*a.idtest+10*b.idtest+c.idtest) from tbtest a
join tbtest b on 1=1 join tbtest c on 1=1;

result :
invalid request BLR at offset 91
function ADDDAY is not defined
module name or entrypoint could not be found

select 100*a.idtest+10*b.idtest+c.idtest, addDay2(cast('2001-01-01' as timestamp),100*a.idtest+10*b.idtest+c.idtest) from tbtest a
join tbtest b on 1=1 join tbtest c on 1=1;

Result ok :

But both functions is working from FB1.5 to FB2.5

It seems that
the entry point module name has become case sensitive in FB2.5.7

For old database with stored procedure or view depends on udf function, we cannot drop/create to correct the entry point 's caractere case.
Except create empty database with correct metadata and then insert data.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Though it was not mentioned but from this DB location "/var/lib/firebird/data/test.fdb" I guess you are using linux.
When you say that entrypoint with wrong case worked on it in old firebird versions that looks like fantazy. Please take a look:

#⁠ ./isql -z employee
ISQL Version: LI-V2.5.5.26952 Firebird 2.5
Server version:
LI-V2.5.5.26952 Firebird 2.5
Database: employee

SQL> show function ADDDAY;
Function ADDDAY:
Function library is fbudf
Entry point is addDay
...
SQL> show function ADDDAY2;
Function ADDDAY2:
Function library is fbudf
Entry point is addday
...
SQL> select addday(current_date, 10) from rdb$database;

               ADDDAY 

=========================
2017-03-27 00:00:00.0000

SQL> select addday2(current_date, 10) from rdb$database;
Statement failed, SQLSTATE = 39000
invalid request BLR at offset 35
-function ADDDAY2 is not defined
-module name or entrypoint could not be found
SQL>

May be you were using firebird on other OS pre 2.5.7?

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Cannot Reproduce [ 5 ]

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