Functional Dependencies in SQL GROUP BY

The SQL standard knows an interesting feature where you can project any functional dependencies of a primary (or unique) key that is listed in the GROUP BY clause without having to add that functional dependency to the GROUP BY clause explicitly. What does this mean? Consider this simple schema: CREATE TABLE author ( id INT … Continue reading Functional Dependencies in SQL GROUP BY

Write C-Style Local Static Variables in Java 16

Java 16 includes an improvement that makes the language a bit more regular via JEP 395. The JEP says: Static members of inner classes It is currently specified to be a compile-time error if an inner class declares a member that is explicitly or implicitly static, unless the member is a constant variable. This means … Continue reading Write C-Style Local Static Variables in Java 16

The jOOQ Parser Ignore Comment Syntax

jOOQ's parser can't parse every possible SQL syntax. Try this random PostgreSQL syntax: ALTER SYSTEM RESET ALL And the jOOQ parser will complain: DOMAIN, INDEX, SCHEMA, SEQUENCE, SESSION, TABLE, TYPE, or VIEW expected: [1:7] ALTER [*]SYSTEM RESET ALL That's perfectly fine. The goal of the jOOQ parser isn't to understand all vendor specific syntax. The … Continue reading The jOOQ Parser Ignore Comment Syntax

Use jOOλ’s Sneaky Throw to Avoid Checked Exceptions

Don't you hate how you have to wrap checked exception throwing code in static initialisers? E.g. you cannot write this in Java: public class Test { static final Class<?> klass = Class.forName("org.h2.Driver"); } There's an unhandled ClassNotFoundException, and you can't catch / rethrow it simply. A static initialiser is needed: public class Test { static … Continue reading Use jOOλ’s Sneaky Throw to Avoid Checked Exceptions