DBCaching not working on Postgresql 9.1

I am trying to switch from MySql to Postgresql 9.1. I just found out that caching is not working with Postgresql. I wonder is it only with 9.1, or maybe my configuration is wrong?

This is my test code:


            

$key= 'test1';

$value = Yii::app()->cache->get($key);

$cached = 'From cache';

if($value === false)

{

$cached = 'Not from cache ';

$value = 'some data';

Yii::app()->cache->set($key, $value, 5);                

}

echo "$cached  $value";



With Postgresql it allways echoes ‘Not from cache some data’

My configuration for Postgresql:




         'cache'=>array(

            'class'=>'system.caching.CDbCache',

            'autoCreateCacheTable' => true,

            'cacheTableName' => 'kes_tabela',

            'connectionID' => 'db',

         ),

             'db'=>array(

			'connectionString' => 'pgsql:host=localhost;port=5432;dbname=biblioteka2',

			'emulatePrepare' => true,

			'username' => 'postgres',

			'password' => 'mypassword',

			'charset' => 'utf8',

			'schemaCachingDuration' => 60,

                        'enableProfiling' => true,

		),



I can write and read database, everything else is working, except caching.

I changed cache table definition and now it works.




CREATE TABLE cache_table

(

	id CHAR(128) PRIMARY KEY,

	expire INTEGER,

	value TEXT -- by default it is BYTEA for postgresql, I changed it to TEXT

)



I am worried not to introduce some side effect this way. Is there any reason why this column was originaly declared as BLOB and not TEXT?

Changing table definition was not good idea, database schema could not be cached that way. The problem was with PDO and that Postgresql changed the default way of retriving data. It used to be in escape format and now it is in hex. After switching back to escape format everything was OK.


ALTER DATABASE biblioteka2 SET bytea_output='escape';