Comment 2 for bug 1412950

Revision history for this message
Robert Lyon (robertl-9) wrote :

I did a test on my local instance where I set up two pages:

A) page1 with urlid=page1
B) page2 with urlid=page2

I go to the db and check that the unique index is present
"view_urlowngroins_uix" UNIQUE, btree (urlid, owner, "group", institution)

I then update, via db, the urlid of [B] to 'page1' and the database lets me.

This also works on mysql db

I note here: http://www.postgresql.org/docs/9.3/static/indexes-unique.html

"Null values are not considered equal."

So I suspect that unique index is not working how we expect it to due to 2 out of the four columns needing to be null.

I'm wondering if it would be better in mahara instead of having 'owner', 'group', 'institution' as three fields and requiring two of them to be null at any one time we change it to 'owner', 'ownertype' where ownertype can be mapped to an ownertype table containing 1=user,2=group,3=institution that way we wouldn't need to fuss with nulls and that we can follow the ownership of group/institution items better - eg what user made/edited a group or institution page.