Fixed two postgres bugs. Mysql still needs work