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

Using PrimaryKey fails with h2.Database #1051

Closed
Rotzlucky opened this issue Sep 17, 2020 · 3 comments
Closed

Using PrimaryKey fails with h2.Database #1051

Rotzlucky opened this issue Sep 17, 2020 · 3 comments

Comments

@Rotzlucky
Copy link

Rotzlucky commented Sep 17, 2020

Duplicate of #841

To reproduce check out https://github.com/Rotzlucky/ExposedH2Example

uses:
kotlin_version=1.3.72 ktor_version=1.1.3 exposed_version=0.27.1 h2_version=1.4.197

When running the application you get the error message:

org.jetbrains.exposed.exceptions.ExposedSQLException: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "ALTER TABLE USERS ALTER COLUMN ID VARCHAR(190) PRIMARY[*] KEY"; SQL statement: ALTER TABLE USERS ALTER COLUMN ID VARCHAR(190) PRIMARY KEY [42000-197]

Error goes away after removing the primaryKey statement from User.kt

Exception doesn't occur when connecting to mysql or sqlite

In an older project, still on exposed 0.13.5 (which brings its own dependency of h2(1.4.197)), the exception doesn't occur either.

Tapac added a commit that referenced this issue Sep 18, 2020
…imary key #841

Using PrimaryKey fails with h2.Database #1051
@Tapac
Copy link
Contributor

Tapac commented Sep 21, 2020

Please consider updating to h2 1.4.197 and check the issue again.

@Tapac Tapac closed this as completed Sep 21, 2020
@Rotzlucky
Copy link
Author

Hey!
Thx for the response. But that is the exact version I'm using in the above example.

@Tapac
Copy link
Contributor

Tapac commented Sep 21, 2020

It fixed in master, will be released soon (this week I guess).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants