Here’s the latest installment in the series on LLM-assisted coding over at The New Stack: Techniques for Using LLMs to Improve SQL Queries.
The join was failing because the two network_interfaces columns contained JSONB objects with differing shapes; Postgres’ JSONB containment operator, @>, couldn’t match them. Since the JSONB objects are arrays, and since the desired match was a key/value pair common to both arrays, it made sense to explode the array and iterate through its elements looking to match that key/value pair.
Initial solutions from ChatGPT, Copilot Chat, and newcomer Unblocked implemented that strategy using various flavors of cross joins involving Postgres’ jsonb_array_elements function.
The rest of the series:
1 When the rubber duck talks back
2 Radical just-in-time learning
3 Why LLM-assisted table transformation is a big deal
4 Using LLM-Assisted Coding to Write a Custom Template Function
5 Elevating the Conversation with LLM Assistants
6 How Large Language Models Assisted a Website Makeover
7 Should LLMs Write Marketing Copy?
8 Test-Driven Development with LLMs: Never Trust, Always Verify
9 Learning While Coding: How LLMs Teach You Implicitly
10 How LLMs Helped Me Build an ODBC Plugin for Steampipe