Hi
There are a problen with this query in postgresql
db_query('DELETE ta FROM {term_access} ta LEFT JOIN {term_data} td ON ta.tid = td.tid WHERE ta.tid <> 0 AND ISNULL(td.tid)');
In postgresql is only possible "Delete from", not "delete xxx from"
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | taxonomy_access.patch | 2.69 KB | plj |
Comments
Comment #1
cpugeniusmv commentedFixed in 5.x-2.x-dev and 6.x-1.x-dev.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
plj commentedThis is NOT fixed in 6.x-1.x-dev. Not even close.
The following MySQL-specific features (among others) cannot be used in PostgreSQL:
WHERE td.tid IS NULL”)Building a DELETE query for data that is selected by join would be rather complicated and end up using PostgreSQL-specific code; better way would be to run “
SELECT ta.tid FROM {term_access} ta LEFT JOIN {term_data} td ON ta.tid = td.tid WHERE ta.tid <> 0 AND td.tid IS NULL” and then use the result set of that query in a foreach loop that deletes the relevant rows.The problematic function is taxonomy_access_enable().
Comment #4
plj commentedOK, here is a patch that really squashes this bug.
Note that this could still be better because it might work on all DBs, but I don't currently have any MySQL setup to test it on, so I left the MySQL code as it is, as I didn't want to break anything.
Comment #5
cpugeniusmv commentedThanks.
http://drupal.org/cvs?commit=211860
Comment #6
plj commentedPhew, you had actually noticed that I had forgotten my table prefixes into the patch! I only realised it now, after you'd already committed it. Thanks for fixing that!