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).
select * from TaBlEnAmE
will reference the same table asselect * from tablename
orselect * from TABLENAME
create table "tableName" (id integer primary key);
, and thencreate table "tablename" (id integer primary key);
then this queryselect * from TaBlEnAmE;
will select from "tablename", not from "tableName". "Unquoted names are always folded to lowercase".