[CDBI] Fwd: find_or_create() barfs with constraints

Aaron Turner aturner at musecurity.com
Wed Aug 3 21:29:11 BST 2005


Hi Everyone,

I hate to admit this, but the problem was with me.  I'm still  
learning PostgreSQL (converting over from MySQL) and the my2pg.pl  
script removed one of the fields of my unique key which was the cause  
of the failure to insert.  Doh.

Thanks for all your help.

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


On Aug 3, 2005, at 8:25 AM, Johnny Morano wrote:

> Ah sorry!
>
> And thanks!
>
> And I always created a multi-column primary key (with an index on a
> autoincrement-column, usually called 'id') in the situation you
> explained. I see it can be done easier too... :-/
>
> cya!
>
> On Wed, 2005-08-03 at 11:16 -0400, Ricardo SIGNES wrote:
>
>> * Johnny Morano <jmorano at moretrix.com> [2005-08-03T06:14:40]
>>
>>> Isn't the primary key supposed always to be unique?
>>>
>>> [...]
>>>
>>> Correct me if I'm wrong of course ;-)
>>>
>>
>> You're right, but off-point.  The question was about unique keys that
>> aren't the primary key, not a primary key that isn't unique.
>>
>> I might have a Kings of England database with three columns:  
>> monarchid,
>> name, sequence.  monarchid is the primary id and must be unique, and
>> then I could further specify that (name, sequence) form a unique  
>> index,
>> apart from the primary key.  So, you can't have two Edward the  
>> Firsts.
>>
>> _______________________________________________
>> ClassDBI mailing list
>> ClassDBI at lists.digitalcraftsmen.net
>> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>>
> -- 
>
> Johnny Morano | insaniac at moretrix.com | +32.473 894685
> [ perl rookie ] | [ linux geek ] | [ web kid ] | [ all ]
> '%*;s{}{ohn};s.$.n.;;%@;s|(.*?)$|$1y|;s%^%j%;%;;print;*%'
>
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>
>





More information about the ClassDBI mailing list