I have postgresql (psql) and cannot delete a block that I create manually. This is because delta is a varchar yet use with numbers and thus whoever wrote the code did not put the quotes necessary for Postgresql.
In the following code, you need to quote the %d variable on the 2nd line as shown:
[...snip...]
/**
* Deletion of custom blocks.
*/
function block_box_delete_submit($form, &$form_state) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_state['values']['bid']);
db_query("DELETE FROM {blocks} WHERE module = 'block' AND delta = '%d'", $form_state['values']['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => $form_state['values']['info'])));
cache_clear_all();
$form_state['redirect'] = 'admin/build/block';
return;
}
[...snip...]
The code snippet is from /modules/block/block.admin.inc, the bug is on line 336.
Thank you.
Alexis Wilke
Comments
Comment #1
AlexisWilke commentedThis bug is still present in 6.5 and 7.x
Does someone care about Postgres users?! 8-)
The error in 7.x branch can be found on lines 309 and 341. (rev 1.19)
Do I have the right to change the file myself?
Thank you.
Alexis Wilke
Comment #2
AlexisWilke commentedJust missed marking the previous post as a patch... Maybe that will make things move a little faster? 8-)
Comment #3
Anonymous (not verified) commentedYou need '%s' and not '%d' to make it more relevant that delta is a varchar column.
Comment #4
AlexisWilke commentedAnd you had to have me fix that?!
Comment #5
Anonymous (not verified) commentedYes, I wasn't doing development I was doing a review; I wasn't even on my development machine.
Comment #6
dries commentedI've committed this to the CVS HEAD and DRUPAL-6 branches. Thanks Alexis.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.