Skip to content
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

Compilation error in generated code when global object references conflict with schema names #15383

Closed
10 tasks done
lukaseder opened this issue Jul 11, 2023 · 1 comment
Closed
10 tasks done

Comments

@lukaseder
Copy link
Member

lukaseder commented Jul 11, 2023

The following simple DDL script can't be used as a source of code generation in jOOQ:

CREATE SCHEMA tables;
CREATE SCHEMA sequences;
CREATE SCHEMA domains;
CREATE SCHEMA keys;

CREATE TABLE tables.t (i int);
CREATE SEQUENCE sequences.s;
CREATE DOMAIN domains.d AS int; 
CREATE TABLE keys.t (i int, CONSTRAINT pk_t PRIMARY KEY (i));

The global object references generated this way will conflict with the schema names. The schema class is generated first, and then overwritten by the global object references class, leading to compilation errors in generated tables, for example, which reference the schema:

    @Override
    public Schema getSchema() {
        return aliased() ? null : Tables.TABLES; // Tables.TABLES does not exist
    }

The solution is to disambiguate the global object references class name in GeneratorStrategy::getGlobalReferencesJavaClassName, etc.

Affected global references files include:

  • Domains
  • Indexes
  • Links
  • Keys
  • UDTs
  • Queues
  • Routines
  • Sequences
  • Tables
  • Triggers
@lukaseder lukaseder added this to the Version 3.19.0 milestone Jul 11, 2023
@lukaseder lukaseder added this to To do in 3.19 Other improvements via automation Jul 11, 2023
lukaseder added a commit that referenced this issue Jul 11, 2023
lukaseder added a commit that referenced this issue Jul 11, 2023
lukaseder added a commit that referenced this issue Jul 11, 2023
3.19 Other improvements automation moved this from To do to Done Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant