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

Boolean expressions cannot be passed to COALESCE function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 10.15.2.0
    • None
    • SQL
    • None
    • Normal
    • Repro attached, Workaround attached
    • Deviation from standard

    Description

      While this parses just fine:

      values(
        nullif(
          1 = 0,
          exists(values(1))
        )
      );
      

      This doesn't work:

      values(
        coalesce(
          1 = 0,
          exists(values(1))
        )
      );
      

      Resulting in:

      SQL Error [30000] [42X01]: Syntax error: Encountered "=" at line 3, column 7.

      The workaround is to wrap both arguments in parentheses

      values(
        coalesce(
          (1 = 0),
          (exists(values(1)))
        )
      );
      

      I don't think there's a good reason for this limitation, so I'm guessing it's a parser bug?

      Attachments

        Activity

          People

            Unassigned Unassigned
            lukas.eder Lukas Eder
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: