Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • SQL
    • None

    Description

      This ticket contains three things:
      1. Accept 'on' and 'off' as input for boolean data type

      SELECT cast('no' as boolean) AS false;
      SELECT cast('off' as boolean) AS false;
      

      2. Accept unique prefixes thereof:

      SELECT cast('of' as boolean) AS false;
      SELECT cast('fal' as boolean) AS false;
      

      3. Trim the string when cast to boolean type

      SELECT cast('    true   ' as boolean) AS true;
      SELECT cast('     FALSE' as boolean) AS true;
      

      More details:
      https://www.postgresql.org/docs/devel/datatype-boolean.html
      https://github.com/postgres/postgres/blob/REL_12_BETA1/src/backend/utils/adt/bool.c#L25
      https://github.com/postgres/postgres/commit/05a7db05826c5eb68173b6d7ef1553c19322ef48
      https://github.com/postgres/postgres/commit/9729c9360886bee7feddc6a1124b0742de4b9f3d

      Other DBs:
      http://docs.aws.amazon.com/redshift/latest/dg/r_Boolean_type.html
      https://my.vertica.com/docs/5.0/HTML/Master/2983.htm
      https://github.com/prestosql/presto/blob/b845cd66da3eb1fcece50efba83ea12bc40afbaa/presto-main/src/main/java/com/facebook/presto/type/VarcharOperators.java#L108-L138

      Attachments

        Issue Links

          Activity

            People

              younggyuchun YoungGyu Chun
              yumwang Yuming Wang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: