The root problem is this query:
select doc.fullName from XWikiDocument doc where doc.space = 'Test '
Due to the default database collation (I think) the constraint doc.space = 'Test '
ignores trailing whitespaces. It doesn’t ignore leading whitespaces though. So the following queries:
select doc.fullName from XWikiDocument doc where doc.space = 'Test'
select doc.fullName from XWikiDocument doc where doc.space = 'Test '
return the same results: the pages from all spaces that start with “Test” followed by any number of whitespaces. So while you can create two separate spaces “Test” and "Test " in the XWikiSpaces
table, the queries performed on the XWikiDocuments
table will treat those two spaces as a single one.
Related issue https://jira.xwiki.org/browse/XWIKI-11617 .
@vmassol when you close https://jira.xwiki.org/browse/XWIKI-14972 did you check if the XWikiSpace
was properly cleaned up after the rename? ATM the rename operation succeeds but the XWikiSpace
table is not cleanup because the query of XWIkiDocuments still finds pages (from the new space after the rename). Could this be caused by the index on the doc.space column?
<property name="space" type="string" column="XWD_WEB" length="768" index="DOC_SPACE" not-null="true" />