← Back to team overview

mahara-contributors team mailing list archive

[Bug 1412950] Re: Problem displaying page when two or more pages have the same clean url

 

"Null values are not considered equal. A multicolumn unique index will
only reject cases where all indexed columns are equal in multiple rows."

I think you've got it. The problem is due to both these sentences
together. It means that ('page1', 1, NULL, NULL) does not "equal"
('page1', 1, NULL, NULL), and so the uniqueness constraint allows it.

Apparently the problem we're facing is what some call "polymorphic
associations". See http://stackoverflow.com/questions/7947218
/polymorphic-association-foreign-key-constraints-is-this-a-good-solution
and http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back/32

The problem with the (owner, ownertype) approach, is that it doesn't
work with Postgres foreign keys. And it would require a rather
substantial refactoring of a large table, during the next database
upgrade.

I think a smaller solution that might also work, is to just split it
into three indexes:

1. (urlid, author)
2. (urlid, group)
3. (urlid, institution)

Although in practice, dropping and recreating indexes also tends to take
a while...

** Changed in: mahara
       Status: Incomplete => In Progress

** Changed in: mahara
   Importance: Low => Medium

** Changed in: mahara
       Status: In Progress => Confirmed

** Also affects: mahara/1.9
   Importance: Undecided
       Status: New

** Also affects: mahara/1.10
   Importance: Undecided
       Status: New

** Also affects: mahara/1.8
   Importance: Undecided
       Status: New

** Changed in: mahara/1.10
   Importance: Undecided => Medium

** Changed in: mahara/1.8
   Importance: Undecided => Medium

** Changed in: mahara/1.9
   Importance: Undecided => Medium

** Changed in: mahara/1.9
       Status: New => Won't Fix

** Changed in: mahara/1.8
       Status: New => Won't Fix

** Changed in: mahara/1.10
       Status: New => Confirmed

** Changed in: mahara/1.10
    Milestone: None => 1.10.3

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1412950

Title:
  Problem displaying page when two or more pages have the same clean url

Status in Mahara ePortfolio:
  Confirmed
Status in Mahara 1.10 series:
  Confirmed
Status in Mahara 1.8 series:
  Won't Fix
Status in Mahara 1.9 series:
  Won't Fix

Bug description:
  This occurred for a site using clean urls

  A user had two pages containing the same cleanurl so that neither
  could be displayed.

  Got this error:
  [WAR] c9 (lib/errors.php:747) get_record_sql found more than one row. If you meant to retrieve more than one record, use get_records_*, otherwise check your code or database for inconsistencies

  I've been unable to replicate this problem via the system (only editing the db directly).
  I've tried:
  - copying a page
  - copying a page from a collection
  - exporting and then importing pages
  - editing page 'title & description'

  But none of these allow me to end up with a duplicate.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1412950/+subscriptions


References