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

Avoid dialect version lookup in AbstractDatabase, if unnecessary #14764

Closed
lukaseder opened this issue Mar 9, 2023 · 4 comments
Closed

Avoid dialect version lookup in AbstractDatabase, if unnecessary #14764

lukaseder opened this issue Mar 9, 2023 · 4 comments

Comments

@lukaseder
Copy link
Member

jOOQ 3.14 introduced an automatic dialect version lookup in AbstractDatabase to override the default: #9834

This may be unnecessary:

  • The user already configured a versioned dialect, as opposed to the family
  • The dialect isn't versioned

Some dialects may be potentially slow to look up versions, e.g. Trino has a bug here:

Producing:

image

@lukaseder
Copy link
Member Author

Fixed in jOOQ 3.19.0, 3.18.1 (#14765), 3.17.10 (#14766), and 3.16.16 (#14767)

3.19 Other improvements automation moved this from To do to Done Mar 9, 2023
@djarnis73
Copy link

I'm not sure if this is related to this issue, but I have a unit test that uses a MockConnection/MockProvider that now logs a stack trace:

09:35:52.665 [main] ERROR org.jooq.impl.DefaultExecuteContext.logVersionSupport - Error reading database version
java.sql.SQLFeatureNotSupportedException: Unsupported Operation
	at org.jooq.tools.jdbc.MockConnection.getMetaData(MockConnection.java:417) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.DefaultExecuteContext.connection(DefaultExecuteContext.java:571) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.DefaultExecuteContext.connection(DefaultExecuteContext.java:553) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:295) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:295) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.SelectImpl.fetchLazy(SelectImpl.java:2862) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.DefaultDSLContext.fetchLazy(DefaultDSLContext.java:5004) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.DefaultDSLContext.fetchOne(DefaultDSLContext.java:4800) ~[jooq-3.16.16.jar:na]
	at org.jooq.impl.DefaultDSLContext.fetchOne(DefaultDSLContext.java:4795) ~[jooq-3.16.16.jar:na]

when doing:

        MockProvider mockProvider = new MyMockProvider();
        MockConnection connection = new MockConnection(mockProvider);
        DSLContext create = DSL.using(connection, SQLDialect.H2);
        create.fetchOne(MY_TABLE);

It started doing it after I moved from 3.16.14 to 3.16.15 but still shows it on 3.16.16.

Would it make sense to also not query version for mock connections?

@lukaseder
Copy link
Member Author

Thanks, @djarnis73. can you please create a new issue?

@lukaseder
Copy link
Member Author

Thanks, @djarnis73. can you please create a new issue?

Nevermind, I've seen that github now has a new feature to turn a comment into an issue: #14833

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

2 participants