Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6584

Comparisons between BOOLEAN and other types sometimes succeed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.10.2.0
    • None
    • SQL
    • None
    • Release Note Needed
    • Deviation from standard

    Description

      I would have expected the following queries to fail because of type mismatch between CHAR and BOOLEAN:

      ij> values 'abc' = true, true = 'xyz', false = 'yes';
      1    
      -----
      true 
      true 
      false
      
      3 rows selected
      ij> values 'abc' in (true, false), true in ('abc', 'def');
      1    
      -----
      true 
      true 
      
      2 rows selected
      

      Similar queries using INTEGER values instead of CHAR values fail as expected:

      ij> values 1 = true;
      ERROR 42818: Comparisons between 'INTEGER' and 'BOOLEAN' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
      ij> values true = 1;
      ERROR 42818: Comparisons between 'BOOLEAN' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
      ij> values true in (1,2,3);
      ERROR 42818: Comparisons between 'BOOLEAN' and 'INTEGER' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
      ij> values 1 in (true, false);
      ERROR 42818: Comparisons between 'INTEGER' and 'BOOLEAN' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. SELECT tablename FROM sys.systables WHERE CAST(tablename AS VARCHAR(128)) = 'T1')
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              knutanders Knut Anders Hatlen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: