OK, I ran the test code doing the inserts into a new (empty) table. The error didn't happen. So there must be some problem with the data in the existing table and/or index. (From my Googling around it looks like a matter of the table and index being out of sync? But I'm not sure what that means.) I've reindexed the table, but I'm not sure how else to go about fixing it.
I had no idea when I migrated to postgre that I would need to work with the db directly this much. The app ran fine with sqlite so I just assumed (naively) that web2py would handle the migration and I could continue to work through web2py's dal. So I realize that the issue now is partly my lack of understanding of postgre. But any help is much appreciated. Ian On Thursday, March 26, 2015 at 1:32:37 PM UTC-4, Ian W. Scott wrote: > > Repairing the table definition didn't help. I'm now going to try the > operations on a fresh table. > > On Thursday, March 26, 2015 at 10:42:33 AM UTC-4, Ian W. Scott wrote: >> >> Thanks Niphlod. I hired someone to migrate the db from sqlite to postgre >> and there seem to be some bugs in the migration. I hadn't noticed the lack >> of reference fields because they were originally there. I think the guy I >> hired must have removed them (?!). I'll try repairing the table definition >> first. >> >> The unique constraint, though, is on the db index not on the table >> fields, right? >> >> On Wednesday, March 25, 2015 at 6:42:10 PM UTC-4, Niphlod wrote: >>> >>> apart from the repetitive table definition (why reinstating IS_IN_DB >>> when you can do it simply using 'reference table' instead of db.table ?).... >>> >>> did you try creating the same table from scratch ? i.e. a tag_records2 >>> table, which you can try your things on. >>> >>> It seems that there is a unique constraint on the table, but your model >>> isn't reflecting that enforcement. Maybe you had some migration issues. >>> >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

