Can PostgreSQL create a case sensitive database? I'm porting some code from some version of Sybase to PostgreSQL. This is a C application that uses the Sybase client library. My approach is to write a translation layer that translates calls to dbsqlexec() to PQexec() (for example). That part is mostly working.

It appears that the Sybase database is set up in a case sensitive manner (with respect to database object names). For example, there is both a WIDGET table and a widget table. It looks like the convention in this application is that the all-uppercase names indicate the actual data tables, while the lowercase names are used as temporary tables when running some processing.

According to 4.1 Lexical Structure, "Key words and unquoted identifiers are case insensitive." I know that I can double-quote identifiers to disable automatic folding to lowercase, but I don't want to have to do that manually through the zillions of lines of code that uses this database.

Is there a way to set up PostgreSQL to disable this automatic case folding for database object identifiers?

My alternative will be to write some code that examines each SQL statement and puts double quotes around every identifier (that is not a keyword).
I ended up writing some code that transforms the SQL generated by the application into PostgreSQL-compatible SQL. It's pretty straightforward:


Split the statement into sensible tokens, skipping single-quoted string literals
Double-quote anything that is not a keyword or number


I also took advantage of this layer to transform calls to isnull to coalesce. So far it's working pretty well.