-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDBSchema not designed for case-sensitive databases #19
Comments
This was really tricky! But now it should work with the help of the new IDBAdapter.isCaseSensitive() method ;-) |
Hi Ivan, do you have a chance to test my changes and give some feedback how they work for you? |
Hello Eike, I just tried the related fix you pushed on master and got some errors using our own postgres13 dbAdapter or the default H2 db. In both case, the issue occurs when we restart the cdo server after a first init. But in practice, tables are created in the default "public" schema in PostGres, and "PUBLIC" with H2. [ERROR] Table "CDO_BRANCHES" already exists; SQL statement: |
Hi Séb, Sorry for the disruption! Usually I try to fix bugs without breaking existing usages. In this case it was very complex because of the different DB behaviors and with restarts of existing databases in mind. At some point I decided to ignore existing Postgres databases because I concluded that they really can't exist with the former (buggy) PostgresAdapter. Of course I didn't consider custom Postgres adapters ;-( On the other hand I'm still not sure I fully understand the nature of your problem, so here come a few questions:
|
Hi guys, I am highly interested in a working Postgres adapter. Changing the schema that CDO uses is a very good idea. Therefore, we could easily combine CDO with our own database optimizations and functionality. How can I help you? |
Hello Eike, thanks for your answser. To me the new behaviour causing this issue is in the org.eclipse.net4j.db.DBUtil.forEachTable where you are specifically checking the schemaName in the metaData.getTables result. Previously the schema was not checked, and tables names were collected whatever the schema. But i agree it sounds like a good idea to clearly identify the target schema in the db to allow the integration of CDO into an existing DB. |
In my next commit I'll add two ways to explicitly specify the schema name to use for (the
The effective schema name of a repository is determined in this order:
I hope that this resolves the remaining issues and causes no disruption for existing users / databases. |
This should be available in build I20231013-0501 in a few minutes. |
Hello Eike, I managed to make experiments with our postgres adapter. I added both isCaseSensitive and getDefaultSchemaName in it. I managed to get something working, but with the following limitations:
@openMonArch : for your info, I have shared our Postgres adapter with Eike. We only tested it with Postgres 13, I don't know if it works with other versions, but we would be happy to contribute it to CDO if it makes sense! :) |
During the past days I've implemented a few more things related to dealing with DB element naming and schema handling. Most significantly the ability to use quoted element names, which completely prevents all possible problems that were caused by DB vendor-specific mangling of element names. Here's a summary of the new functionalities:
|
Important Note: Opening existing databases can be problematic with the new code, especially the automatic quoting of all names! The new code attempts to detect these situations and outputs something like the following to the console:
I apologize for this potential disruption after migrating to the new code, but I'm convinced that using quoted names is the only way to address the different name conversion behaviors of all the different DB vendors. |
All the mentioned changes are now pushed . Please test this new version and report problems here! |
I-build |
Hi Eike,
Based on the discussion https://www.eclipse.org/forums/index.php/t/1113597/ , it would be nice to have org.eclipse.net4j.internal.db.ddl.DBNamedElement.class.name(String name) configurable. If possible, it might return name as is, converted to lower case, converted to upper case.
I don't know if other DBMS are case sensitive or not, but Postgres is case sensitive. I have all objects in lower case, like schemas and table names, so name(String name) converting names to upper case brings some problems.
The text was updated successfully, but these errors were encountered: