I am currently adding Postgresql support to the castor doclet (castordoclet.sourceforge.net), using classes developped by Brian D. Williams and hit this lowercase identifier issue.
Patric Bechtel wrote:
If go the 1. way, I will have problems with database supportingthis is probably an FAQ item, as it was asked several times before. The key issue here is: Postgres lowercases all table/column names before interpreting them if and only if there are no quotes around them. So, there are two solutions to your problem: 1. Lowercase all table and column names in your mapping.xml 2. Recreate all your tables and using uppercase WITH quotes around each identifier mentioning table or column names. The second one is probably a PITA. I use lowercased names all around, because even psql isn't capable of correctly autocomplete these uppercase created table names, so you have to type them completely.
mixed case identifiers. I could apply the 2. solution, but this one
has some drawbacks you describe...
There may be a third way : change the PostgreSQLFactory.quoteName() to
- lowerCase the identifiers
or
- not add double quotes around names
Here is a patch to do the first :
Index: src/main/org/exolab/castor/jdo/drivers/PostgreSQLFactory.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/jdo/drivers/PostgreSQLFactory.java,v
retrieving revision 1.10
diff -r1.10 PostgreSQLFactory.java
94a95
> String aux = name.toLowerCase();
96c97
< index = name.indexOf( '.' );
---
> index = aux.indexOf( '.' );
98,99c99,100
< return "\"" + name.substring( 0, index ) + "\".\"" + name.substring( index + 1 ) + "\"";
< return '"' + name + '"';
---
> return "\"" + aux.substring( 0, index ) + "\".\"" + aux.substring( index + 1 ) + "\"";
> return '"' + aux + '"';
Any comments ?
--
Mickael Guessant
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
