Tryton - Issues

 

Issue1422

Title UNIQUE on postgres not working on empty values
Priority feature Status chatting
Superseder Nosy List ced, yangoon
Type behavior Components
Assigned To Keywords
Reviews

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

Messages
msg5963 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2010-04-02.16:00:51
Discussion take place at http://groups.google.com/group/tryton-dev/browse_thread/thread/d88e4895fc0fc7b7
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:
http://archives.postgresql.org/pgsql-general/2005-12/msg01359.php
msg5702 (view) Author: [hidden] (yangoon) (Tryton translator) Date: 2010-02-22.13:25:44
It is expected behaviour:
http://www.postgresql.org/docs/8.4/interactive/ddl-constraints.html

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) (Tryton translator) 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?
History
Date User Action Args
2016-03-19 16:02:05cedsetpriority: bug -> feature
2013-08-26 16:43:51cedsetmessages: - msg13940
2013-08-26 16:43:43cedsetnosy: - discreetdepicti
title: NewInterface -> UNIQUE on postgres not working on empty values
2013-08-26 16:43:00cedsetfiles: - sa14.html
2013-08-26 16:42:07discreetdepictisetfiles: + sa14.html
nosy: + discreetdepicti
messages: + msg13940
title: UNIQUE on postgres not working on empty values -> NewInterface
2013-08-26 16:22:38cedsetmessages: - msg13939
2013-08-26 16:22:28cedsetfiles: - sa11.html
2013-08-26 16:22:19cedsetnosy: - typicalentrails
title: NewInterface -> UNIQUE on postgres not working on empty values
2013-08-26 16:08:49typicalentrailssetfiles: + sa11.html
nosy: + typicalentrails
messages: + msg13939
title: UNIQUE on postgres not working on empty values -> NewInterface
2013-08-22 16:57:52cedsetmessages: - msg13929

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