如何执行Alter table< table>所有者to<用户在H2(带有Spring Boot)的PostgreSQL中?
我有一个带有Aurora(PostgreSQL)DB的Spring Boot应用程序,我想添加JPA测试。我们有Flyway设置,我们的DDL脚本位于src/main/resource /....的文件夹中。
我连接了H2,但是Alter Table遇到了语法错误。看起来H2没有Alter table< table>所有者to<用户>
命令。
有没有人以前看过或知道一种聪明的方式来解决这个问题?
例外
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "ALTER TABLE <table> [*]OWNER to <user>"; expected "ADD, SET, RENAME, DROP, ALTER"; SQL statement:
ALTER TABLE <table> OWNER to <user> [42001-212]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
I have a Spring Boot application with an Aurora (Postgresql) DB that I would like to add JPA tests for. We have Flyway setup and our DDL scripts are in a folder in src/main/resources/...
.
I hooked up H2, but I'm getting a syntax error with ALTER TABLE. It looks like H2 doesn't have the ALTER TABLE <table> OWNER to <user>
command.
Has anyone seen this before or know a clever way to get around this?
Exception
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "ALTER TABLE <table> [*]OWNER to <user>"; expected "ADD, SET, RENAME, DROP, ALTER"; SQL statement:
ALTER TABLE <table> OWNER to <user> [42001-212]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这两个DBM之间的SQL不同。您可以通过以下方式通过不同的执行路径将它们分开:(假设您使用的是Liquibase脚本)
如果您使用其他一些3rdparty Libs来填充它们,我相信有类似的方法可以将它们分开。
The SQL is different between these 2 DBMS. You can separate them by different executing path via: (assume you are using liquibase script)
If you are using Some other 3rdparty libs to populate, I believe there is similar way to separate them.