Pull request to the Yii core repository with this feature patch was declined due to MySQL lock-in (MSSQL, Oracle, PgSQL doesn’t support such feature at all). So i’ve decided to throw it to the gist: https://gist.github.com/3215023
Maybe would be handy for somebody.