Tryton - Issues



Title UNIQUE on postgres not working on empty values
Priority feature Status resolved
Superseder Nosy List ced, reviewbot, roundup-bot, yangoon
Type feature request Components trytond
Assigned To ced Keywords review
Reviews 44061002
View: 44061002

Created on 2010-02-21.16:19:31 by yangoon, last changed by roundup-bot.

New changeset af9e97b0a1a9 by C├ędric Krier in branch 'default':
Add Exclude constraint
review44061002 updated at
review44061002 updated at
msg38652 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-02-27.19:32:03
Indeed the best option is to use the new EXCLUDE constraint [1] which allows to use an expression.
This is not part of the SQL standard but there is nothing in the standard that allow to support this feature.
Also this allows to create constraint on a subset of rows thanks to the WHERE clause.

msg33081 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-04-04.09:03:37
Here is another possible solution:
msg5963 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-04-02.16:00:51
Discussion take place at
msg5959 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-04-02.11:02:33
Using unique index with coalesce works only for Postgresql.
msg5703 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-02-22.13:33:23
This could be a solution:
msg5702 (view) Author: [hidden] (yangoon) Date: 2010-02-22.13:25:44
It is expected behaviour:

In general, a unique constraint is violated when there is more than one row in the table where the values of all of the columns included in the constraint are equal. However, two null values are not considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior conforms to the SQL standard, but we have heard that other SQL databases might not follow this rule. So be careful when developing applications that are intended to be portable.
msg5701 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-02-21.23:17:51
You should report it to PostgreSQL to see if it is expected behavior.
msg5696 (view) Author: [hidden] (yangoon) Date: 2010-02-21.16:19:31
I am running postgres 8.3, which seems not to take in account empty values on composed UNIQUE constraints. So it is currently possible with UNIQUE(name, parent) to create party categories of the same name if they don't have a parent.

How to handle this in general? Should tryton insert 0 for an integer resp. '' for a string to have working UNIQUE on empty values?
Date User Action Args
2018-03-19 16:59:00roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg39098
2018-03-19 16:54:47reviewbotsetmessages: + msg39096
2018-02-27 19:49:44reviewbotsetnosy: + reviewbot
messages: + msg38655
2018-02-27 19:43:59cedlinkissue7174 superseder
2018-02-27 19:37:10cedlinkissue7173 superseder
2018-02-27 19:33:43cedsetstatus: in-progress -> testing
reviews: 44061002
keyword: + review
2018-02-27 19:32:03cedsetstatus: chatting -> in-progress
assignedto: ced
component: + trytond
messages: + msg38652
type: behavior -> feature request
2017-04-04 09:03:37cedsetmessages: + msg33081
2016-03-19 16:02:05cedsetpriority: bug -> feature
2013-08-26 16:43:51cedsetmessages: - msg13940

Showing 10 items. Show all history (warning: this could be VERY long)