Opened 11 years ago

Closed 9 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


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@… 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by dan@…

comment:1 Changed 11 years ago by Alex Gaynor

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

comment:2 Changed 10 years ago by fhahn

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:

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

comment:3 Changed 9 years ago by Tim Graham

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 Changed 9 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 5240b83462ba4887b67da8d493dfdc23fec5df97:

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

Thanks dan at 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