Opened 10 years ago

Last modified 9 years ago

#24509 closed New feature

Allow Expressions when saving new models — at Initial Version

Reported by: Alex Hill Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: me@… 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

Opening a ticket after discussion on IRC with Josh.

You can use Expression when updating models, but it would also be useful to be able to use them when creating models, particularly in order to apply database functions to newly-inserted values.

My specific use case for this is a PostgreSQL TSVectorField, where instead of just inserting a value, I want to insert strip(to_tsvector(<ts_config>, unaccent(<value>))). Ideally, I would be able to define these all as Funcs and insert an Expression.

I propose to fix this by making SQLInsertCompiler check for resolve_expressions and as_sql, as SQLUpdateCompiler does.

Alex

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top