For anyone using AI tools, here is something for you to try.
Imagine you have SQLite database with a following schema & data:
create table addresses (ipv4 blob not null);
insert into addresses (ipv4) values (x'c0ae1337');
The task is pretty simple:
Return IP v4 address in a human readable format.
Answers:
IP v4 address in a dotted-decimal format
192.174.19.55
https://sqlite.org/json1.html#jptrSQL query
select
printf('%s.%s.%s.%s',
'0x'||substr(hex(ipv4), 1, 2) ->>'$',
'0x'||substr(hex(ipv4), 3, 2) ->>'$',
'0x'||substr(hex(ipv4), 5, 2) ->>'$',
'0x'||substr(hex(ipv4), 7, 2) ->>'$'
) as ipv4
from addresses;
How I ended up with IPv4 address stored as blob in SQLite?
Well, I was running some experiments and I didn’t want to deal with string manipulations for this task. After all IPv4 is just 4 bytes, right?
Later, when I wanted to retrieve the address in a human-readable format, it turned out to be a bit convoluted in SQLite. I could have handled this easily in PostgreSQL, but SQLite doesn’t have built-in support for IP types.
So, I decided to try some AI tools. After 15 minutes I gave up and ended up reading the documentation. Do I regret the wasted time? Yes – AI gave me dozens of queries, all of which returned incorrect results, contained syntax errors or were simply hallucinations.
Why am I writing this post?
I ran a little quiz with about 20 friends, asking them to solve the same task. Only one person got the correct answer (but they failed to generate a proper query with AI).
Most people quickly answered 0.0.0.7 or another wrong IP without validating their results. Some were just copy-pasting invalid queries. I was frustrated because how many of you blindly trust AI tools.
I am not saying that all those AI tools are bad, I just want you to use those tools wisely. LLMs were trained on open-source projects, but who graded the quality of those projects?
If you don’t want to think yourself, then please don’t name yourself a Software Engineer (because you are a Prompt Engineer).