[WIP] Fix pg boolean conversion

Merge of complementary PR's #527 and #564 + some fixes. Contributing it as an result of the (extended) phpconference.nl 2014 hackathon. 
Same here, can you clarify the return type? `mixed` is kinda like a limbo