Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-1841

week function in teiid not returning expected value

    XMLWordPrintable

Details

    • Quality Risk
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Done
    • 7.1
    • 8.0
    • ODBC
    • None
    • Low

    Description

      One of our users of our teiid instance as reported that the week function (to determine which week of the year it is) operates in teiid a little different to how they expect.

      Teiid resets the week count to 1 on every 1st of January even though
      the day is not the 1st day of the week (Sunday in here).
      But Postgres will only resets the week count to 1 only on the 1st Monday
      of the year.

      The examples below compare the results return by teiid and Postgres:

      # Teiid result:
      
      EngVDBR=> select week(parsedate('2011-01-01', 'yyyy-MM-dd')) AS Week;
      week
      ------
      1
      (1 row)
      
      EngVDBR=> select week(parsedate('2011-01-02', 'yyyy-MM-dd')) AS Week;
      week
      ------
      2
      (1 row)
      
      # Postgres result:
      
      postgres=> SELECT EXTRACT(WEEK FROM DATE '2011-01-01') AS Week;
      week
      ------
      52
      (1 row)
      
      
      postgres=> SELECT EXTRACT(WEEK FROM DATE '2011-01-03') AS Week;
      week
      ------
      1
      (1 row)
      

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            graeme.gillies Graeme Gillies (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: