Oracle column names case-sensitivity

(Tomasz) #1

As I wrote in my updated Cookbook article, Oracle table names are only case-sensitive, when passed inside quotation marks. Therefore, it seems that somewhere in Yii code underlying below ActiveRecord there have to be a part which escapes table name with quotation mark, making above mentioned problems.

Can anyone approve this is true? And if so - is this really necessary? I must admit that it drives me a little bit crazy, that if porting application from another RDBMS to Oracle I have to manually update each model and nearly each file to change fields names to uppercase! :confused:

(Maurizio Domba Cerin) #2

I think here we have too few developer working with oracle or they are not using the forum too much…

I don’t know oracle… but check the googlecode issues -…ii/updates/list

there are many issues regarding ORACLE (I remember some where about quoting)… .already solved so check that you search solved issues…

on some issues there are many comments, maybe some can be helpfull to you…

at least you can see who is posting and responding on the oracle issues and maybe contact them directly as it’s obvious that they do not answer here…

NOTE: and use the latest Yii from trunk, as there where solved some issues with oracle lately

(Tomasz) #3

Thanks for your support. But I’m pretty sure that this problem lies in core code of Yii. For some reason, fields’ names (and tables’ names too) are quoted when sent to PDO/DB which has no impact on other RDBMS but causes huge problems in Oracle.

I started this thread to get answer from dev team is it necessary to quote name or maybe this "feature" could be removed?

Maybe this thread should be moved to Feature Request forum?

(Maurizio Domba Cerin) #4

have you tried with the latest Yii trunk? Have you searched the issues on this?

Here are some:

(Tomasz) #5

Oops! Sorry for that! :( Let’s say that my search engine got broken! :)

All right. I added my comment to bug 1767 and we can close this thread. Thank you! EoT.

(Mh) #6

I don’t know about your Oracle problems but you do know that the keyField name is configurable? (like pretty much everything in yii, so i don’t understand your complaints)



Uuhm - somehow your last response magically disappeared :)

(Tomasz) #7

Yes, Mike. It disappeared and you answered yourself, why! :}

This is the effect of writing posts without double checking of documentation. Sorry for the mess! :]

EDIT: And of course! Thank you for your effort finding answer for my question! :>

(Pokorny Dominik) #8


I have the same problem with oracle names. I would like the database to accept lower-case just as upper-case table and column names…

It says here it could be configured somehow by configurating keyField ?? I’m very new to Yii and I dont know how and where to put such configuration… can someone please point me in a right direction ??

Thank you

(Greg Tyler) #9

I can’t remember how I got to this topic, but just in case anyone else does, here’s how I fixed this. I created a new component “OciSchema” which replaces the “quoteSimple*Name” methods with functions that only replace reserved words. I also limited that reserved word list to table/column names in my database because I have tight control over that. You may want a broader list:


class OciSchema extends COciSchema {

    private $reserved = array('ACCESS','SESSION','MODE','LEVEL','DESC','FROM','TO','YEAR');

    public function quoteSimpleTableName($name) {

		return in_array($name,$this->reserved) ? '"'.$name.'"' : $name;


	public function quoteSimpleColumnName($name) {

		return in_array($name,$this->reserved) ? '"'.$name.'"' : $name;



To implement, you simply need to include the following in your DB config (compenents -> db):

'driverMap' => array('oci'=>'OciSchema'),

This is a full or perfect solution but it fits our scenario and may fit your’s too.