Use of "? in (SELECT some_col FROM some_table)" subqueries results in error
---------------------------------------------------------------------------

                 Key: CORE-3842
                 URL: http://tracker.firebirdsql.org/browse/CORE-3842
             Project: Firebird Core
          Issue Type: Bug
    Affects Versions: 3.0.0
         Environment: Windows 7 / WI-T3.0.0.29945 Firebird 3.0 Unstable

            Reporter: Mark Rotteveel


Using a query with the condition "? in (SELECT some_col FROM some_table)" 
results in an error -804 Data type unknown. This was suppossed to fixed by 
CORE-2697 for version 3.0, but it appears this is not the case.

Synthetic reproduction script (see also JDBC-94)
CREATE TABLE VALUE_TABLE
(
  INT_COLUMN Integer NOT NULL,
  PRIMARY KEY (INT_COLUMN)
);
COMMIT;
INSERT INTO VALUE_TABLE(INT_COLUMN) VALUES (1);
COMMIT;

set term #;
EXECUTE BLOCK
AS
    DECLARE charResult CHAR(1);
BEGIN
    EXECUTE STATEMENT ('SELECT ''x'' FROM RDB$DATABASE WHERE ? IN (SELECT 
INT_COLUMN FROM VALUE_TABLE)') (1) INTO charResult;
END#
set term ;#

Result:
Engine Code    : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -804
Data type unknown

As stated in CORE-2697 this could be rewritten to use EXISTS, but sometimes 
that is not an option if the query is generated.

-- 
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

        

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to