Hello Sergey

I encountered the same issue some month ago : 
https://groups.google.com/forum/#!searchin/web2py/mysql$20self$20reference/web2py/qonC3j5sOmQ/7Y9QYkXBj4kJ

I opened a ticket about this : 
http://code.google.com/p/web2py/issues/detail?id=1342

In the meanwhile, I moved my database to SQlite to bypass the problem... 
but you can try the following workaround : 
http://code.google.com/p/web2py/issues/detail?id=1342#c6

Le mardi 14 mai 2013 20:23:13 UTC+2, SergeyPo a écrit :
>
> Hello group!
>
> With MySQL, attempt to reproduce self reference example from Web2py book 
> fails when you try to create db record, giving an error 
> <class '_mysql_exceptions.IntegrityError'> (1452, 'Cannot add or update a 
> child row: a foreign key constraint fails (`reftest`.`person`, CONSTRAINT 
> `person_ibfk_1` FOREIGN KEY (`father`) REFERENCES `person` (`id`) ON DELETE 
> CASCADE)')'
> Is it supposed to work with admin interface? Naturally, one has to insert 
> at least one record so that others could reference it.
>
> I have created test application with one table 'person', to reproduce 
> please create table 'reftest' in MySQL console and edit the connection 
> string in db.py
>
> db.define_table('person',
>>     Field('name'),
>>     Field('father', 'reference person'),
>>     Field('mother', 'reference person'))
>
>
>
> To reproduce an error, try to insert a record in the table 'person' using 
> admin interface.
>
> Is there workaround?
>
> Sergey
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to