Re: [Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-16 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
 Reporter:  Vytis Banaitis   |Owner:  Vytis
 |  Banaitis
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"75327b88a829e2c4be1775b24e0cf6349b26ace4" 75327b88]:
 {{{
 #!CommitTicketReference repository=""
 revision="75327b88a829e2c4be1775b24e0cf6349b26ace4"
 [1.10.x] Fixed #27828 -- Fixed a crash when subtracting
 Integer/DurationField from DateField on Oracle/PostgreSQL.

 Thanks Mariusz Felisiak for the Oracle workaround.

 Backport of d5088f838d837fc9e3109c828f18511055f20bea from master
 }}}

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.abd03d90da2c9dc37e017840e1a2eb60%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-16 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
 Reporter:  Vytis Banaitis   |Owner:  Vytis
 |  Banaitis
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"eedf276ed1b247c87d3852db4241da1aa9779589" eedf276e]:
 {{{
 #!CommitTicketReference repository=""
 revision="eedf276ed1b247c87d3852db4241da1aa9779589"
 [1.11.x] Fixed #27828 -- Fixed a crash when subtracting
 Integer/DurationField from DateField on Oracle/PostgreSQL.

 Backport of d5088f838d837fc9e3109c828f18511055f20bea from master
 }}}

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6aec2fecc48d3bb9bab56ef834f980ae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-16 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
 Reporter:  Vytis Banaitis   |Owner:  Vytis
 |  Banaitis
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"d5088f838d837fc9e3109c828f18511055f20bea" d5088f83]:
 {{{
 #!CommitTicketReference repository=""
 revision="d5088f838d837fc9e3109c828f18511055f20bea"
 Fixed #27828 -- Fixed a crash when subtracting Integer/DurationField from
 DateField on Oracle/PostgreSQL.
 }}}

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.7187b7c92627681d895a35bb38787917%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-13 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
 Reporter:  Vytis Banaitis   |Owner:  Vytis
 |  Banaitis
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.add4cb9fa60cdec0e6893ff300dc1779%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-12 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
 Reporter:  Vytis Banaitis   |Owner:  Vytis
 |  Banaitis
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 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
-+-
Changes (by Vytis Banaitis):

 * owner:  nobody => Vytis Banaitis
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/8057 PR]

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.efc4aafdce31a26d59eb770ee1b688dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL

2017-02-12 Thread Django
#27828: ORM crash on F('date_field') - F('int_field') on PostgreSQL
-+-
   Reporter:  Vytis  |  Owner:  nobody
  Banaitis   |
   Type:  Bug| Status:  new
  Component:  Database   |Version:  1.10
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 PostgreSQL allows to use subtraction with a date and an int, returning a
 date. The integer is taken as a time delta in days.

 I was trying to use this in Django.

 {{{#!python
 class DateModel(models.Model):
 date_field = models.DateField()
 int_field = models.IntegerField()
 }}}

 {{{#!python
 In [3]: qs =
 DateModel.objects.annotate(result=ExpressionWrapper(F('date_field') -
 F('int_field'), output_field=DateField()))
 }}}

 However, this query crashes:
 {{{#!python
 In [4]: qs.all()
 Out[4]:
 ---
 ProgrammingError  Traceback (most recent call
 last)
 /home/vytis/src/django/django/db/backends/utils.py in execute(self, sql,
 params)
  61 else:
 ---> 62 return self.cursor.execute(sql, params)
  63

 ProgrammingError: function age(date, integer) does not exist
 LINE 1: ...del"."date_field", "myapp_datemodel"."int_field", age("myapp...
  ^
 HINT:  No function matches the given name and argument types. You might
 need to add explicit type casts.
 }}}

 Generated SQL:
 {{{
 SELECT "myapp_datemodel"."id", "myapp_datemodel"."date_field",
 "myapp_datemodel"."int_field", age("myapp_datemodel"."date_field",
 "myapp_datemodel"."int_field") AS "result" FROM "myapp_datemodel"
 }}}

 While looking for a solution, I came across a typo in
 django/db/models/expressions.py (introduced in
 [changeset:"766afc22a1dfa7d34a08de85356b7bc9dba025e7" 766afc22]):
 
https://github.com/django/django/blob/9718fa2e8abe430c3526a9278dd976443d4ae3c6/django/db/models/expressions.py#L386
 Note the `lhs_output` on both sides of operation.

 Fixing this typo resolves the crash.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.433349467209f749f240b55df1055acb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.