Lukas Eder

@lukaseder.bsky.social

Java Champion, creator of jOOQ, the best way to write SQL in Java. Will mostly post about Java, SQL, jOOQ, programming humour, and write at https://blog.jooq.org

You can join tables with common column names with t1 JOIN t2 USING ( col ) But this leads to a trap! With t1 JOIN t2 USING ( c1 ) JOIN t3 USING ( c2 ) With c2 in just t2 and t3 this works But add c2 to t1 in the future it breaks 😖 @lukaseder.bsky.social demos

Avoiding SQL Ambiguities caused by JOIN USING and NATURAL JOIN

Discover the pitfalls of using SQL's NATURAL JOIN and JOIN USING syntax. Learn best practices for joining tables in production queries.

buff.ly

It's funny how some customers explicitly forbid using their logos on the jOOQ website, only for their engineers to tell just about anyone that they're using jOOQ at every occasion as well as talk to me about it in public 😅

There are joins that can only return rows from the left table Semi join => rows matching the right (IN or EXISTS) Anti join => rows not matching the right (NOT IN or NOT EXISTS) @lukaseder.bsky.social makes the case these should have their own #SQL syntax

Semi Join and Anti Join Should Have Their Own Syntax in SQL

Relational algebra nicely describes the various operations that we know in SQL as well from a more abstract, formal perspective. One of the most common relational JOIN operations is the “equi…

buff.ly

After 18 years of maknig jOOQ, I'm still discovering such subtle differences where trying to insert a long string into a VARCHAR(n) column will raise an error if too long, but casting it to VARCHAR(n) will silently truncate it, e.g. in PostgreSQL: github.com/jOOQ/jOOQ/is... SQL is full of surprises

Bind variable casts truncate VARCHAR(n) ARRAY contents instead of letting the target INSERT raise an error · Issue #19814 · jOOQ/jOOQ

A recently added integration test creates this table: create table "t" ( "dummy" int, "s0" varchar[], "s3" varchar(3)[], primary key ("dummy") ) And asserts that if inserting array['abcd'] into s3,...

github.com

Man, I just love my job. Interesting problems, happy customers, the joys of a great product market fit, flexible work hours (and not too many anymore). Thanks to all you jOOQ customers out there, making this dream-come-true possible!

Huh, interesting. It appears that PostgreSQL decided to go against the SQL standard here ISO/IEC 9075-2:2023(E) 6.34 <JSON value constructor> GR 4) b) i) says that empty tables should produce a JSON array with no elements (intuitively), not NULL. Why this behaviour in PG?

Bild

This little API change allows for omitting some syntactic ceremony when working with EXISTS subqueries in jOOQ: github.com/jOOQ/jOOQ/is... E.g. you can now write: ctx. select(AUTHOR, exists(AUTHOR. book())) .from(AUTHOR) Instead of spelling out the complete correlated subquery.

Change exists(Select<?>) to exists(TableLike<?>) for convenience · Issue #19568 · jOOQ/jOOQ

When checking for existence of records in a table, it could be convenient to be able to write exists(MY_TABLE) instead of exists(selectOne().from(MY_TABLE)). This is especially true when working wi...

github.com