PostgreSQL, LIMIT, and DELETE

AlexisWilke - July 5, 2009 - 20:57
Project:Boost
Version:6.x-1.x-dev
Component:Installation
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Issue tags:postgres
Description

You just cannot use LIMIT with a DELETE statement under PostgreSQL. This may be a limit, and certainly a nice optimization (since once the variable is deleted, you don't have to continue searching... although if the name column is marked as unique, the optimization is already built in any good SQL handler.)

Anyway, please, remove the LIMIT 1 from your install script:

<?php
/**
* Update 6102 - Delete old boost permissions variable.
*/
function boost_update_6102() {
 
// del variable
 
return update_sql("DELETE FROM {variable} WHERE name = 'boost_permissions'");
}
?>

Another way to delete a variable is to use the variable_del() function. Although that one would not return an error list the update_sql() function can.

Thank you.
Alexis Wilke

#1

mikeytown2 - July 6, 2009 - 04:43

Going to use http://api.drupal.org/api/function/comment_update_6002/6 for some inspiration. Thanks for pointing me in the right direction with variable_del().

#2

mikeytown2 - July 6, 2009 - 04:59
Status:active» needs review

If you could test this, that would be great!

AttachmentSize
boost-510892.patch 698 bytes

#3

AlexisWilke - July 6, 2009 - 08:01
Status:needs review» reviewed & tested by the community

Hi mikey,

Looks good! 8-)

Thank you.
Alexis

#4

mikeytown2 - July 6, 2009 - 18:24
Status:reviewed & tested by the community» fixed

committed

#5

System Message - July 20, 2009 - 18:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.