#24894: Add CURRENT_TIMESTAMP function to contrib.postgres
----------------------------------+--------------------------------------
     Reporter:  adamchainz        |                    Owner:  adamchainz
         Type:  New feature       |                   Status:  new
    Component:  contrib.postgres  |                  Version:  1.8
     Severity:  Normal            |               Resolution:
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  1                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------

Comment (by mjtamlyn):

 I agree with Carl that postgres' transaction now is actually more helpful
 than the statement now in most cases. Assuming other databases don't have
 that feature, is there any reason not for us to be opinionated and use the
 better PG implementation in the main `Now()` function added in #24866? In
 most practical use cases they'll be milliseconds off anyway. I guess it's
 the difference between:

 {{{
 now = timezone.now()
 a = Foo.objects.create(created=now)
 b = Foo.objects.create(created=now)
 self.assertEqual(a.created, b.created)
 }}}

 and
 {{{
 a = Foo.objects.create(created=timezone.now())
 b = Foo.objects.create(created=timezone.now())
 self.assertNotEqual(a.created, b.created)
 }}}

 (Of course on older MySQL chances are they'd end up the same in the DB
 anyway!)

 I feel that having both in Django would be confusing and unnecessary.
 Millisecond resolution of timestamp creation is a rare use case and most
 sites wouldn't notice the difference if they changed database.

--
Ticket URL: <https://code.djangoproject.com/ticket/24894#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f08bb7e58179ff7cb6d1aae0b3e3b680%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to