docker pull mysql:8.0.2 docker run --name MYSQL802 --net=host -p 3306:3306 -e MYSQL_ROOT_PASSWORD=test -d mysql:8.0.2Then, connect to this instance and run this nice little query in it:
And get this result:
WITH RECURSIVE t(a, b) AS ( SELECT 1, CAST('a' AS CHAR(15)) UNION ALL SELECT t.a + 1, CONCAT(t.b, 'a') FROM t WHERE t.a < 10 ) SELECT a, SUM(a) OVER (ORDER BY a) AS ∑, b FROM t
a ∑ b -------------------------- 1 1 a 2 3 aa 3 6 aaa 4 10 aaaa 5 15 aaaaa 6 21 aaaaaa 7 28 aaaaaaa 8 36 aaaaaaaa 9 45 aaaaaaaaa 10 55 aaaaaaaaaaWould you believe this is MySQL?
BonusA nice “hidden” feature is the support of new pessimistic locking clauses, in particular
FOR UPDATE SKIP LOCKED. This has been available in Oracle for ages and since recently in PostgreSQL as well, and now in MySQL. A very useful feature when implementing simple message queues or reservation systems. More details in this article here:
MySQL 8.0.1: Using SKIP LOCKED and NOWAIT to handle hot rowsOf course,
NOWAIT) will be supported in jOOQ 3.10 as well.
4 thoughts on “jOOQ 3.10 Supports Exciting MySQL 8.0 Features”
Hi, thank you for sharing.
How do you express this query in jooq ?
The usual static imports are assumed here:
Note, there’s a known issue to get this working on MySQL: https://github.com/jOOQ/jOOQ/issues/6431
The variables a and b are not defined in the code sample. How to define them so that they reference t?
I’ve edited my comment with an example