Issue Details (XML | Word | Printable)

Key: CORE-1379
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Adriano dos Santos Fernandes
Reporter: Kuznetsov Eugene
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Invalid parameter type when using it in CHAR_LENGTH function

Created: 24/Jul/07 03:01 PM   Updated: 29/Dec/07 05:32 AM
Component/s: API / Client Library
Affects Version/s: 2.0.1
Fix Version/s: 2.1 Beta 2

Time Tracking:
Not Specified

Issue Links:
Relate
 


 Description  « Hide
After preparing query

select * from rdb$database
where char_length(:value1) = 1

the type of value1 will be INTEGER

Generally, if parameter is an argument of CHAR_LENGTH, then its type depends on other part's one in equality predicate. No doubt, this behavior is erroneous.

Also, server can't determine parameter type when meeting the single CHAR_LENGTH's call - preparing

select char_length(:value1) from rdb$database

returns ?Data type unknown?.

With best regards, Eugene

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adriano dos Santos Fernandes added a comment - 24/Jul/07 09:07 PM
This is how the engine works, parameters of some expressions assume datatype of the other expression side, i.e., with char_length(?) = 1, the parameter type will be described as integer.

This make sense for substring, for example, but don't for char_length, as you see.

But as also you see, we have problems with parameters alone, i.e., char_length(?) in select list doesn't work, as our API can't describe strings of unknown size.

Given that, I may live with the CHAR_LENGTH bug until we fix the datatype unknown error.

Adriano dos Santos Fernandes added a comment - 25/Jul/07 11:47 AM
The incorrect parameter type description is fixed, and hence I'm closing this ticket, since we have others about "Data type unknown".

Pavel Cisar added a comment - 25/Jul/07 12:47 PM
Adriano, how about CORE-218 ? This ticket depends on it and it's not resolved, so it looks weird that this one get resolved :) You should also resolve the CORE-218 or delete the dependence link.

Adriano dos Santos Fernandes added a comment - 25/Jul/07 12:51 PM
Sorry, I want to say they are related.

But since there is "relate to" and "is related to" and I couldn't differenciate :-), I removed the link now.

Kuznetsov Eugene added a comment - 12/Aug/07 10:51 AM
Sorry for pause.

Adriano dos Santos Fernandes wrote
"But as also you see, we have problems with parameters alone, i.e., char_length(?) in select list doesn't work, as our API can't describe strings of unknown size."
Perhaps, does it make sense to desribe this param as VARCHAR(32765)?

With best regards, Eugene

Dmitry Yemanov added a comment - 12/Aug/07 11:16 AM
Bad idea, actually, as the input message size is limited to 64K and hence you won't be able to use anything like two CHAR_LENGTH(?) calls.

Kuznetsov Eugene added a comment - 12/Aug/07 01:11 PM
To Dmitriy Yemanov

Thanks for info.

With best regards, Eugene