incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Bloodhound" <bloodhound-...@incubator.apache.org>
Subject Re: [Apache Bloodhound] #337: Wrong checking of UNIQUE constraints on insert
Date Mon, 07 Jan 2013 07:47:23 GMT
#337: Wrong checking of UNIQUE constraints on insert
------------------------+------------------------------
  Reporter:  olemis     |      Owner:  nobody
      Type:  defect     |     Status:  new
  Priority:  critical   |  Milestone:  Release 4
 Component:  dashboard  |    Version:  0.3.0
Resolution:             |   Keywords:  model sql insert
------------------------+------------------------------
Changes (by olemis):

 * keywords:   => model sql insert
 * priority:  major => critical
 * cc: olemis+bh@… (added)
 * milestone:   => Release 4


Old description:



New description:

 Two checks are performed immediately before inserting new records in the
 database . Firstly key values are proven to be unique . Afterwards column
 uniqueness is asserted. If any of them fails then an exception is raised
 to indicate that target row already exists.

 Fact is that the second check as it stands nowadays will always fail if
 `cls._meta['unique_fields']` is empty . For instance , for this model
 class

 {{{
 #!python

 class ProductSetting(ModelBase):
     """The Product configuration table
     """
     _meta = {'table_name':'bloodhound_productconfig',
             'object_name':'ProductSetting',
             'key_fields':['product', 'section', 'option'],
             'non_key_fields':['value', ],
             'no_change_fields':['product', 'section', 'option'],
             'unique_fields':[],
             }

 }}}

 ... second (i.e. uniqueness) query looks like this

 {{{
 #!sql

 SELECT product,section,option,value FROM bloodhound_productconfig

 }}}

 As a consequence it is impossible to insert more than a single value in
 target model table.

--

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/337#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Mime
View raw message