Closed guewen closed 3 years ago
ping @simahawk
The unique constraint considers NULL as distinct values, you can have several NULL values in records:
odoo@localhost:testdb> create table test (id integer, name varchar);
CREATE TABLE
Time: 0.011s
odoo@localhost:testdb> create unique index test_unique on test(name);
CREATE INDEX
Time: 0.007s
odoo@localhost:testdb> insert into test(id, name) values (1, 'foo');
INSERT 0 1
Time: 0.005s
odoo@localhost:testdb> insert into test(id, name) values (2, 'foo');
duplicate key value violates unique constraint "test_unique"
DETAIL: Key (name)=(foo) already exists.
Time: 0.005s
odoo@localhost:testdb> insert into test(id, name) values (3, NULL);
INSERT 0 1
Time: 0.003s
odoo@localhost:testdb> insert into test(id, name) values (4, NULL);
INSERT 0 1
Time: 0.003s
oh we'll need an upgrade step to remove the constrain I think
We don't change the constraint, only required :) so an upgrade is enough (I tested to be sure).
I tested to be sure)
great, tnx :)
/ocabot merge patch
What a great day to merge this nice PR. Let's do it! Prepared branch 13.0-ocabot-merge-pr-69-by-simahawk-bump-patch, awaiting test results.
Congratulations, your PR was merged at cd3ff8a3ed0348b12ea1a67949bf5b632b887297. Thanks a lot for contributing to OCA. ❤️
In some cases, we want to use a tech_name, but we do not use server environment on all the records, so tech_name should not be required.