[CDBI] Fwd: find_or_create() barfs with constraints

Aaron Turner aturner at musecurity.com
Wed Aug 3 22:14:44 BST 2005


Correct.  The issue is that this table had both a primary key (using  
a sequence (AUTO_INCREMENT in mysql speak) and *another* unique key  
which was supposed to contain two columns (but only contained one).   
The failure to insert problem had to do with the second unique key  
not being unique over a the single column.  See Ricardo's example of  
Kings of England earlier in this thread for what's going on.

-- 
Aaron Turner, Sr. Security Engineer                        
<aturner at musecurity.com>


On Aug 3, 2005, at 4:29 AM, Johnny Morano wrote:

> Isn't the primary key supposed always to be unique?
>
> quote: 'The primary key of a relational table uniquely identifies each
> record in the
> table.' (http://databases.about.com/cs/administration/g/ 
> primarykey.htm)
>
> So if you're using multiple columns for PK, the combination of those
> columns (values) must unique.
>
> Correct me if I'm wrong of course ;-)
>
> cya
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>
>





More information about the ClassDBI mailing list