PostgreSQL Upper versus Lower Case


I have an example database, used when I test some Framework and I do create it under Firebird, MySQL, Oracle, PostgreSQL and SQL Server.

I always use Upper Case for my Table and Fields names.

But MySQL creates the Tables Lower Case and PostgreSQL creates both, Tables and Fields, Lower Case.

I have generated the code for Yii, using Yii tools, with a MySQL Connection.

The code works fine for MySQL, SQL Server and Oracle.

But when I try to connect to PostgreSQL I get an error when Yii invokes an Upper Case field name, instead of a Lower Case.

To get connected to the database I have to change the table name in the following function to Lower Case:

public function tableName()

But there is no configuration for Field names.

Is there any way to tell Yii to generate the Field names allways Upper Case ?


Make sure the tables are named in upper-case in your database. When you use "CREATE TABLE" statement, you will need to quote the table name so that the case can be preserved.

Dear Qiang Xue,

I am starting to use Yii and just would like to say that you created a really nice software framework.

My main experience with programming is with Delphi and C#.NET.

Some years ago I saw PRADO and it's fantastic Event Driven aproach, but did not have any opportunity to use it, since I was programming mainly in .NET.

Now I'm back to PHP (but still with .NET), and after reading that you are moving PRADO efforts to Yii, I have studied MVC and started with Yii.

My only complain (but do not care about it) is that I prefer the ASP.NET like PRADO notation that Yii notation:









<%= echo CHtml::linkButton('Delete',array(



        'confirm'=>"Are you sure to delete #{$model->CHAVE}?")); %>

But I will survive :wink:

Thanks for you job