#18833: Model returns incorrect values from Postgres DB View
-------------------------------------+-------------------------------------
     Reporter:  paul.ortman@…        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:  invalid
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by paul.ortman@…):

 Replying to [comment:3 aaugustin]:
 > If `USE_TZ = True`, the database connection will be set to UTC, meaning
 aggregation will be performed in UTC.
 >
 > If `USE_TZ = False`, the database connection is set to `TIME_ZONE`.
 >
 > When you're connecting directly to PostgreSQL, the connection uses the
 system time zone.
 >
 > As a consequence, aggregating on a DateTimeField by day can return
 different values, since the day of a datetime depends on the time zone.


 Exactly the right diagnosis.  Changin USE_TZ to False returned all the
 expected information.  Thank you.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18833#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to