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

Generator does not report file in which invalid SQL was found #9121

Closed
codemonstur opened this issue Aug 31, 2019 · 3 comments
Closed

Generator does not report file in which invalid SQL was found #9121

codemonstur opened this issue Aug 31, 2019 · 3 comments

Comments

@codemonstur
Copy link

When there is SQL in a migration file that JOOQ doesn't understand it prints an error like so:

[ERROR] An exception occurred while parsing script source : src/main/resources/db/migration/*. Please report this error to https://github.com/jOOQ/jOOQ/issues/new

The error message prints the script source as it is configured (with wildcard). I'd like it to print the actual file where it found the error.

@lukaseder
Copy link
Member

Thank you very much for your suggestion. Incidentally, we've discussed this just recently and we're going to improve internal APIs that allow for tracking these sources.

We don't have an issue for this yet, but yours will do :) We'll definitely improve this message in the future.

@lukaseder lukaseder added this to To do in 3.13 DDL interpretation via automation Jan 20, 2020
@lukaseder lukaseder self-assigned this Jan 20, 2020
@lukaseder
Copy link
Member

There's already an INFO log message indicating which file is being read just before the error occurs:

[INFO] Reading from: C:\Users\lukas\jOOQ\master\workspace\jOOQ-pro\jOOQ-test-codegen\src\main\resources\javabeansgettersandsetters.sql [*]

However, I'll also add an additional ERROR log message just below:

[ERROR] DDLDatabase Error        : Your SQL string could not be parsed or interpreted. This may have a variety of reasons, including:
- The jOOQ parser doesn't understand your SQL
- The jOOQ DDL simulation logic (translating to H2) cannot simulate your SQL

If you think this is a bug or a feature worth requesting, please report it here: https://github.com/jOOQ/jOOQ/issues/new/choose

As a workaround, you can use the Settings.parseIgnoreComments syntax documented here:
https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-parser/
[ERROR] Error while loading file: C:\Users\lukas\jOOQ\master\workspace\jOOQ-pro\jOOQ-test-codegen\src\main\resources\javabeansgettersandsetters.sql
[ERROR] An exception occurred while parsing script source : C:\Users\lukas\jOOQ\master\workspace\jOOQ-pro\jOOQ-test-codegen/src/main/resources/*gettersandsetters.sql. Please report this error to https://github.com/jOOQ/jOOQ/issues/new
org.jooq.impl.ParserException: Identifier expected: [38:19] ... "K_Mn"  INT,
  "K_MO"  INT
);

CREATE TABLE foo ([*]);

The new message being:

[ERROR] Error while loading file: C:\Users\lukas\jOOQ\master\workspace\jOOQ-pro\jOOQ-test-codegen\src\main\resources\javabeansgettersandsetters.sql

@lukaseder
Copy link
Member

The specific implementation of this fix depends on #9725 and a few other changes, which is why this will not be backported to 3.12.

3.13 DDL interpretation automation moved this from To do to Done Jan 20, 2020
lukaseder added a commit that referenced this issue Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants