创建VIEW时出现HSQLDB错误

时间:2023-01-19 18:41:51

I am using HSQLDB for my integration tests to create tables and views in-memory. When I run my test, it fails to create the view. I get the below mentioned exception

我正在使用HSQLDB进行集成测试,以在内存中创建表和视图。当我运行我的测试时,它无法创建视图。我得到了下面提到的例外

Error thrown executing CREATE VIEW `ipv6space_view` AS SELECT 
`ipv6space`.`id` AS `id`, `ipv6space`.`ipvpn_id` AS `ipvpn_id`, 
INET6_NTOA(`ipv6space`.`base_address`) AS `base_address`, 
`ipv6space`.`length` AS `length`, `ipv6space`.`type` AS `type`, 
`ipv6space`.`purpose` AS `purpose`, `ipv6space`.`ptr` AS `ptr`, 
`ipv6space`.`abonnement_id` AS `abonnement_id` FROM `ipv6space` : 
unexpected token:  required: AS
java.sql.SQLSyntaxErrorException: unexpected token:  required: AS
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source)

The same statement works fine when I try it with MYSQL.

当我用MYSQL尝试它时,同样的语句工作正常。

Any help is much appreciated.

任何帮助深表感谢。

1 个解决方案

#1


0  

You need to turn on MySQL compatibility mode with this statement:

您需要使用以下语句打开MySQL兼容模式:

 set database sql syntax mys true

#1


0  

You need to turn on MySQL compatibility mode with this statement:

您需要使用以下语句打开MySQL兼容模式:

 set database sql syntax mys true