AI Hallucinated a Table That Was Never There

AI
No Comments

AI hallucinated a table, wrote a lovely query against it, and handed the whole thing over without blinking. Say hello to Cardinal.

Three panel cartoon. Sam asks the red bird for last quarter revenue. The bird types in a blur and calls the query poetry. Sam says there is no table called Revenue Final, and the bird replies that there should be.

Cardinal Rules. A Saturday cartoon about AI and databases.

Cardinal is the small red bird who lives on top of Sam’s monitor. Cardinal is the AI. Cardinal will write any query you ask for in about half a second, and has never once said the words I do not know.

That last part is the whole problem.

A model writes fluent SQL because it has read an enormous amount of SQL. It has never read your database. So when a question needs a table your schema does not have, the model does not stop and ask. It reaches for the most likely name in the world, Revenue_Final, and carries on. The grammar is perfect. The joins make sense. The table is fiction.

This is the most common AI mistake I see in database work, and it almost never looks like a mistake. Broken code throws a loud red error and everybody pays attention. This one throws Invalid object name, and somewhere a helpful person creates the table.

The fix costs ten seconds. Paste the real schema in before you ask, not after the query comes back. Give the model the tables and columns it is allowed to touch, and say plainly that it may not invent any others. Cardinal is not guessing to be difficult. Cardinal is guessing because nobody said what was actually there.

Cardinal Rule

AI writes for the database it imagined. You run it on the one you have.

Schema first, question second. That order saves an afternoon.

Cardinal has started reading two of my books, purely out of self interest. On the desk this season: AI: Nobody’s in There. But we’re still in here. (on Amazon) and 100 AI Interview Questions and Answers for Data Professionals (Kindle, also on Amazon.in, paperback and audiobook).

Next Saturday, somebody asks Cardinal how many rows are coming back.

A query that runs is not a result, it is a first draft with good handwriting.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

AI, Database, DBA, SQL Humor
Previous Post
AI Generated ETL Worked on Day One. Then Came Monday.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.