Block visibility not working with non-numeric block delta's

in

The block delta is a string, and not a number, so this query needs to use %s instead of %d.
The column definition from system.install is:
   delta varchar(32) NOT NULL default '0',