-
Notifications
You must be signed in to change notification settings - Fork 373
Closed
Description
H2 officially supports only OFFSET / FETCH from the SQL Standard:
https://h2database.com/html/commands.html#select
H2 accepts it unconditionally (even in compatibility modes for database systems without its support).
But H2Dialect
produces non-standard LIMIT
/ OFFSET
for a some reason:
Lines 48 to 60 in ae9d42e
public String getLimit(long limit) { | |
return "LIMIT " + limit; | |
} | |
@Override | |
public String getOffset(long offset) { | |
return "OFFSET " + offset; | |
} | |
@Override | |
public String getLimitOffset(long limit, long offset) { | |
return String.format("LIMIT %d OFFSET %d", limit, offset); | |
} |
H2 accepts this legacy syntax only in Regular, Legacy, DB2, HSQLDB, MariaDB, MySQL, and PostgreSQL compatibility modes.
https://h2database.com/html/features.html#compatibility
It isn't accepted in Strict, Derby, MSSQLServer, and Oracle compatibility modes and it causes syntax errors like that one:
https://stackoverflow.com/questions/72880912/spring-boot-2-7-1-with-data-r2dbc-findbyid-fails-when-using-h2-with-mssqlserve
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug