Opened 12 years ago

Closed 10 years ago

#17027 closed New feature (fixed)

Let ExpressionNodes use __pow__

Reported by: dan@… Owned by: fhahn
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: flo@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Not sure what consequences this has for databases that don't support raising to powers, but I didn't see any exception handling for the +, -, /, %, etc so I didn't add it to this patch.

Please send any feedback.

Attachments (1)

add_pow_to_expression_node.diff (741 bytes ) - added by dan@… 12 years ago.

Download all attachments as: .zip

Change History (5)

by dan@…, 12 years ago

comment:1 by Alex Gaynor, 12 years ago

Component: UncategorizedDatabase layer (models, ORM)
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 by fhahn, 11 years ago

Cc: flo@… added
Needs tests: unset
Owner: changed from nobody to fhahn
Patch needs improvement: unset
Status: newassigned
Version: 1.3master

I've updated the patch, added tests and created a pull request: https://github.com/django/django/pull/746

Oracle, Postgres and Mysql have a power function, but there isn't one in sqlite.

comment:3 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

Pending a final ORM review, this looks good to me, and I've verified the tests are passing on all backends. Updated PR.

comment:4 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 5240b83462ba4887b67da8d493dfdc23fec5df97:

Fixed #17027 -- Added support for the power operator in F expressions.

Thanks dan at dlo.me for the initial patch.

  • Added pow and rpow to ExpressionNode
  • Added oracle and mysql specific power expressions
  • Added used-defined power function for sqlite
Note: See TracTickets for help on using tickets.
Back to Top