Fwd: [FB-Tracker] Assigned: (CORE-5395) Invalid data type for negation (minus operator)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: [FB-Tracker] Assigned: (CORE-5395) Invalid data type for negation (minus operator)

Adriano dos Santos Fernandes-3
Hi!

Please see this bug and comments.

Vlad pointed an inconsistency in v3.

But v2.5 has many inconsistencies too. I don't think replicate them is
going to be good.


1) The parameter (related to the unary minus operator is described as TEXT):

SQL> set sqlda_display on;
SQL>
SQL> select 1 from rdb$database where '1' = -?;

INPUT  SQLDA version: 1 sqln: 10 sqld: 1
01: sqltype: 452 TEXT                    sqlscale: 0 sqlsubtype: 0 sqllen: 1
  :  name: (0)  alias: (0)
  : table: (0)  owner: (0)

OUTPUT SQLDA version: 1 sqln: 20 sqld: 1
01: sqltype: 496 LONG                    sqlscale: 0 sqlsubtype: 0 sqllen: 4
  :  name: (8)CONSTANT  alias: (8)CONSTANT
  : table: (0)  owner: (0)
Statement failed, SQLSTATE = 07002
Dynamic SQL Error
-SQL error code = -804
-SQLDA missing or incorrect version, or incorrect number/type of variables


2) In (1) it can deduce (wrongly) parameter in a nested expression. But
here it can't deduce in first level and next in second level:

SQL> select 1 from rdb$database where 1 + ? = -?;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-expression evaluation not supported
-Invalid data type for negation (minus operator)


3) But now inverting the expression (same inconsistency showed by Vlad
in v3) happens in v2.5:

SQL> select 1 from rdb$database where -? = 1 + ?;

INPUT  SQLDA version: 1 sqln: 10 sqld: 2
01: sqltype: 580 INT64                   sqlscale: 0 sqlsubtype: 0 sqllen: 8
  :  name: (0)  alias: (0)
  : table: (0)  owner: (0)
02: sqltype: 580 INT64                   sqlscale: 0 sqlsubtype: 0 sqllen: 8
  :  name: (0)  alias: (0)
  : table: (0)  owner: (0)


We need clear rules on how to deduce parameters types.


Adriano


> Invalid data type for negation (minus operator)

> -----------------------------------------------
>
>                 Key: CORE-5395
>                 URL: http://tracker.firebirdsql.org/browse/CORE-5395
>             Project: Firebird Core
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 3.0.1
>         Environment: FB 3.0.1 (WI-V6.3.1.32609 Firebird 3.0) x64
> Windows 7
>            Reporter: verleon
>            Assignee: Adriano dos Santos Fernandes
>
> meta:
> CREATE TABLE TABLE1 (
>     ID  INTEGER
> );
> query:
>  
> select 1 from TABLE1 where id = - :param
>  
> result:
>  
> Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements.
> Dynamic SQL Error.
> expression evaluation not supported.
> Invalid data type for negation (minus operator).
>  
> This problem is gone when using  - (cast :param as integer)  instead of  - :param, but with FB 2.5 it was not necessary

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Loading...