the application I am developing should work with mysql and postgres. I want to store a compressed String into the Database. No problem with mysql and LONGBLOB. But if I switch to postgres and bytea I get a CDbException:

CDbCommand failed to execute the SQL statement: SQLSTATE[22021]: Character not in repertoire: 7

I am able to store it after using the pg_escape_bytea function (not yet sure about getting the correct string back :) ). Any ideas on using Active Record with database independent code to make that work?

I tried to use Yii DAO with Parameter Binding and and seems to work. Is there an equivalent for Active Record?

Cound you give more details on how you are using Bytea on postgres?