Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Keep SQL constraint #27045

Closed

Conversation

nseinlet
Copy link
Contributor

Constraints in SQL are faster than python equivalent.
Adding a coalesce in PostgreSQL constraint doesn't seems possible.
This combination of constraint and weird named unique index is the
fastest way to ensure a unique constraint with NULL values.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Copy link
Contributor

@JKE-be JKE-be left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

si tu le dis et que ca marche ;)

@nseinlet nseinlet force-pushed the saas-11.5-webisteconstraint-nse branch from ee325ac to 385ff09 Compare September 18, 2018 09:38
@C3POdoo C3POdoo added the RD research & development, internal work label Sep 18, 2018
@nseinlet nseinlet force-pushed the saas-11.5-webisteconstraint-nse branch 2 times, most recently from 8828dc0 to 1b98184 Compare September 20, 2018 08:39
Constraints in SQL are faster than python equivalent.
Adding a coalesce in PostgreSQL constraint doesn't seems possible.
This combination of constraint and weird named unique index is the
fastest way to ensure a unique constraint with NULL values.

This index require the website_id to be present in the res_users
table. To do this, a stored readonly related field is used.
@nseinlet nseinlet force-pushed the saas-11.5-webisteconstraint-nse branch from 1b98184 to 2d027bb Compare September 20, 2018 09:58
@nseinlet
Copy link
Contributor Author

Merged.

@nseinlet nseinlet closed this Sep 20, 2018
@nseinlet nseinlet deleted the saas-11.5-webisteconstraint-nse branch September 20, 2018 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants