On Feb 14, 2014, at 4:29 PM, Michael Hipp <mich...@redmule.com> wrote:

> On 2/14/2014 2:34 PM, Michael Bayer wrote:
>> 
>> A basic fact of a self referential relationship is that you're building a 
>> tree.  The root of the tree has to be NULL and I'd advise against trying to 
>> work around that.
>> 
>> Now if you wanted to in fact assign the object's own primary key to the 
>> foreign key column, you can (manually), but even then, you'd need to know 
>> the primary key up front.  If you're relying on the database to generate a 
>> primary key value, you still won't have that value in time, and the column 
>> would still be NULL.
> 
> It seems to work ok if I just fake the id=0 and a1.sire_id=0, we'll see what 
> happens when I move
> to PostgreSQL. So for the moment I can move on to other fires.
> 
> 
>> I think where you're at with this you might want to keep it simple to start.
>> 
> Yes. But I've had this working for quite a while now on the Django ORM, never 
> considered that it was something particularly unusual.

the django ORM would write an autogenerated primary key value to a foreign key 
column at the same time in a single INSERT?   What magic might they have 
discovered there?  (hint: i am sure they don’t do that)

 


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to