Closed (fixed)
Project:
Domain
Version:
6.x-2.0-rc5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2009 at 15:42 UTC
Updated:
6 Jun 2011 at 01:58 UTC
Jump to comment: Most recent file
Steps to reproduce:
1) Create a new domain record
2) Assign a user to that domain on the user's profile page
3) Delete the domain record
Expected result:
"Domain status" group on user's profile page only has bullets for existing domains that the user is assigned to. The domain_editor row for that user and the deleted domain doesn't exist anymore.
Actual result:
"Domain status" group has one more bullet without text. The domain_editor row still exists.
Proposed solution:
Delete the domain_editor database entries for a domain when that domain is deleted.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | domain-378258-2.patch | 1.52 KB | svdoord |
Comments
Comment #1
svdoord commentedOh, by the way, I think a fix to this issue should include an upgrade script that cleans up the domain_editor table by removing all rows for which the corresponding domain doesn't exist anymore.
I'll see if I can roll out a patch, but I don't know yet how such upgrade scripts are created.
Comment #2
svdoord commentedOk, here's a patch for my issue. It adds a DELETE query for domain_editor when a domain is deleted, and it adds a database update function to domain.install.
Please review and hopefully add it to the next release candidate!
Comment #3
agentrickardIs WHERE NOT EXISTS postgres compliant syntax? I don't think it is. We need an ANSI-standard query here.
We try to avoid subselects, too.
The other part of the patch is a nice catch, committed that part.
Comment #4
svdoord commentedIt should work in PostgreSQL just fine. According to this thread (http://codingforums.com/showthread.php?p=780895), it has been in the ANSI SQL standard since 1985. I will test this to make sure; I'm installing PostgreSQL as we speak.
Two questions:
- Why do you try to avoid subselects?
- What would you prefer instead? A loop over the result set of a select, and then a delete for each entry?
Comment #5
svdoord commentedJust verified that the WHERE NOT EXISTS construct works in PostgreSQL 8.3, but again: it is plain ANSI SQL as far as I know. I've used it for many, many years.
Comment #6
agentrickardSubselects can be resource intensive, and require MySQL 4.1 >, which is required for D6, so I suppose it does not matter. A loop is the other option.
WHERE NOT EXISTS is fine.
Comment #7
agentrickardTested and committed. Thanks!
Comment #8
svdoord commentedAnd thanks to you for following up on this so quickly!
Comment #9
agentrickard