I'm going to describe how DBD::mysql works. I suspect DBD::Pg works the same way.

Perl has two ways of storing strings. DBI or DBD::mysql looks at the internal buffer of scalars without checking which storage format was used, so every time you pass a string, it's as if you actually passed