Hello,

 

I have a question about the type inference for case expressions. Consider
this query from the Postgres tests:

https://github.com/postgres/postgres/blob/137b131d6fbd29b4acf740aba3f74220fa
ef2678/src/test/regress/expected/case.out#L136

 

SELECT i AS "Value",

  CASE WHEN (i < 0) THEN 'small'

       WHEN (i = 0) THEN 'zero'

       WHEN (i = 1) THEN 'one'

       WHEN (i = 2) THEN 'two'

       ELSE 'big'

  END AS "Category"

  FROM CASE_TBL;

 

Calcite infers a type of CHAR(5) for the "Category" column, but Postgres
infers a type of VARCHAR.

As a result, using Calcite the output is padded with spaces.

 

Is this the expected result, or is this a bug?

 

Thank you,

Mihai

Reply via email to