I ran across this problem a little bit ago and can't seem to solve it. I have two tables similar to this:
db.define_table('site', Field('site_name', length=255), format='%(site_name)s' ) db.define_table('content', Field('site', db.site, unique=True), Field('slug', length=80, requires=IS_SLUG(check=True), unique=True) ) The idea being that no site can have more than one of the same slug, yet each site could have the same slug. Take this for example: This should work: site = 1, slug = 'test' site = 2, slug = 'test' This should fail: site 1, slug = 'test' site 1, slug = 'test' However, when the table definition was created, only the slug field was marked as unique in MySQL. This makes the section that says "This should work" actually fail and generate a ticket with the following text: Duplicate entry 'test' for key 'slug' Is this a bug or am I not doing this right? I thought I could put unique=True on multiple fields.