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

AlexisWilke’s picture

Version: 6.4 » 7.x-dev
StatusFileSize
new1.54 KB

This 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

AlexisWilke’s picture

Status: Active » Needs review

Just missed marking the previous post as a patch... Maybe that will make things move a little faster? 8-)

Anonymous’s picture

Status: Needs review » Needs work

You need '%s' and not '%d' to make it more relevant that delta is a varchar column.

AlexisWilke’s picture

Status: Needs work » Needs review
StatusFileSize
new1.54 KB

And you had to have me fix that?!

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Yes, I wasn't doing development I was doing a review; I wasn't even on my development machine.

dries’s picture

Status: Reviewed & tested by the community » Fixed

I've committed this to the CVS HEAD and DRUPAL-6 branches. Thanks Alexis.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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