Generating custom foreign keys with default catalog or default schema is not working



@koentsje generating custom foreign keys when you have either a default catalog or default schema is not working. The root cause is the way the functions getCatalogForModel(table.getCatalog(), defaultCatalog); and getSchemaForModel(table.getSchema(), defaultSchema); are written. According to the comments they are meant for the annotations but are being used across the board. When calling those functions with the same catalog as default the return is null, i.e.
getCatalogForModel("DEFAULT_CATALOG", "DEFAULT_CATALOG"); returns null. I believe this behavior should change but there might be a lot of implications to touch it.

I've noticed several "workarounds" in the code (e.g. in the below function fetching the primary keys, first the available Table instance is used to get the reveng configurations) but the same implementation in not done Foreign Keys.


Line 12 in 71fa3da


See below, implementation does not follow the same pattern of trying to fetch configurations first using TableIdentifier tableIdentifier = TableIdentifier.create(table)


Line 74 in 71fa3da


The fix can be done in the (tested with debugger):

Any chance you can patch the current Alpha release?




Koen Aers


Koen Aers