XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      • Cast from any interval type to INTERVAL(YEAR()) currently always results in INTERVAL(MONTH()) type
      • Implement casting between INTERVAL types?

      Postgres:

      postgres=# select CAST('+41 10:17:36.789' AS INTERVAL DAY TO SECOND)::INTERVAL YEAR TO MONTH;
      {{ interval }}
      ----------
      {{ 00:00:00}}
      (1 row)postgres=# select CAST('+01-05' AS INTERVAL YEAR TO MONTH);
      {{ interval }}
      ---------------
      {{ 1 year 5 mons}}
      (1 row)postgres=# select CAST(CAST('+01-05' AS INTERVAL YEAR TO MONTH) AS INTERVAL DAY TO HOUR);
      {{ interval }}
      ---------------
      {{ 1 year 5 mons}}
      (1 row)postgres=# select CAST(CAST('+01-05' AS INTERVAL YEAR TO MONTH) AS INTERVAL DAY TO SECOND);
      {{ interval }}
      ---------------
      {{ 1 year 5 mons}}
      (1 row)

       

      Oracle throws error if you try to switch between YEAR-MONTH to DAY-...SEC:

      select CAST(CAST('+52 10:17:36.789' AS INTERVAL DAY TO SECOND) AS INTERVAL YEAR TO MONTH) FROM DUAL;ORA-00932: inconsistent datatypes: expected INTERVAL YEAR TO MONTH got INTERVAL DAY TO SECOND

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            matriv Marios Trivyzas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: