TOPIC 27/4217 MINNOT STARTED

SQL, regex and small parsing helpers written by AI

A recipe for having an assistant write a database query, a text pattern or a small script, then proving it on a hand-checked sample, row counts and a long input before you use it.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a calculator that never says it is unsure. It always gives a number. If you press the wrong key, you still get a number. You test it on two plus two before you trust it with a bill.

Daily List is a to-do list app. Lily asks an assistant for a (Structured Query Language) query that counts reminders for each user. The query runs. Leo, who has no reminders, shows a count of 1. Nothing warns her. (SYNTHETIC / TRAINING ONLY: Daily List and the people here are invented.).

What it is: The helper may be a , a , or a short script. SQL is the language of the query. A table is a grid. A row is one user or one reminder. A column is one fact, such as user_id. A fan-out join repeats rows and can make a total too big, or, with COUNT(*), can turn a missing match into 1. The neighbour is a query you wrote yourself and already checked. The assistant's query still needs that same check.

Why it matters: A helper that runs is not a helper that is right. Tom's is a : Lily 2, Sam 3, Leo 0. If the query disagrees, he does not ship it.

The same checks cover more than one kind of helper. A regular expression that stalls is ReDoS, so he tries a long input. A (comma-separated values) file and a file are counted in and out. A command line script is read before it runs. A date that depends on a time zone is checked by hand.

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Getting a query, pattern or small script from an assistant, and proving it on known answers before use.

  1. Give names and a sample
  2. Ask for helper and explanation
  3. Run on known answers
  4. Count rows and try long input
  5. Keep the checks
Test the calculator on sums you know

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Sums you already know, like two plus twoA hand-checked sample with a known answer
A calculator that never says errorA query that runs and gives a wrong total
Pressing the key twice by accidentA join that repeats each row
Typing a huge number to see if it hangsA long input that tests a pattern for ReDoS

WHERE THIS PICTURE STOPS

  • A calculator is wrong the same way each time. An assistant may write a different helper on each ask.
  • A calculator does only arithmetic. A query, a pattern and a script each fail in their own way.
  • Small sums miss large-number faults. A small sample can miss faults that only show in big data.

HOOK

Test the calculator on sums you know.

REMEMBER IT THIS WAY

A rule of thumb: if you see this, think that.

If a query total comes back exactly double, usually suspect a join that repeats each row. Compare it with a sample you counted by hand.

What each part of the trick stands for
In the trickWhat it stands for
Double totalA join that repeats each row
Hand countA hand-checked sample with a known answer
Long inputA long input that tests a pattern for ReDoS

It misleads when the true total really is near double, so count by hand before you blame the join.

TELL A FRIEND

Test every helper on a small case whose answer you already know before you trust it with real work.

OFTEN MIXED UP WITH Synthetic data, masking and test files with AI. The earlier lesson made the data to test with. This lesson checks the small helpers that read and change that data.

Sources & standards — 4 sources
  1. Market practice

    Fan-out resolution (Holistics documentation) ↗ — Holistics · When a one-to-many join runs before a sum or count, the single side is repeated and the total counts the copies, which gives a wrong number with no error (search excerpt, page not opened)

    Documentation for one reporting product, used only for the plain description of how a join can repeat rows. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Understanding Regular Expression Denial of Service (ReDoS): Insights from Regexes Written by Language Models and Developer Forums (International Conference on Program Comprehension, 2024) ↗ — Institute of Electrical and Electronics Engineers (IEEE) and Association for Computing Machinery (ACM), International Conference on Program Comprehension · Regular expressions written by language models were tested for being correct and for being open to denial of service; the generated ones mainly showed a slow, polynomial kind of weakness (search excerpt, page not opened)

    A research paper on the models tested then. Newer tools may differ. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    Re(gEx|DoS)Eval: Evaluating Generated Regular Expressions and their Proneness to DoS (ICSE 2024) ↗ — International Conference on Software Engineering (ICSE) · A benchmark of real user regular-expression requests scores generated patterns on whether they work and on whether they are open to denial of service (search excerpt, page not opened)

    A short research paper that proposes a way to score generated patterns. It is not advice for a team. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Test::Regexp (Perl module documentation) ↗ — MetaCPAN · It is important to test which strings do not match a regular expression as well as which do (search excerpt, page not opened)

    Documentation for one test module in one language, used for the general habit of testing non-matches. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

PRACTISE AND KEEP

Sources for this topic — 4 sources
  1. Market practice

    Fan-out resolution (Holistics documentation) ↗ — Holistics · When a one-to-many join runs before a sum or count, the single side is repeated and the total counts the copies, which gives a wrong number with no error (search excerpt, page not opened)

    Documentation for one reporting product, used only for the plain description of how a join can repeat rows. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  2. Market practice

    Understanding Regular Expression Denial of Service (ReDoS): Insights from Regexes Written by Language Models and Developer Forums (International Conference on Program Comprehension, 2024) ↗ — Institute of Electrical and Electronics Engineers (IEEE) and Association for Computing Machinery (ACM), International Conference on Program Comprehension · Regular expressions written by language models were tested for being correct and for being open to denial of service; the generated ones mainly showed a slow, polynomial kind of weakness (search excerpt, page not opened)

    A research paper on the models tested then. Newer tools may differ. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  3. Market practice

    Re(gEx|DoS)Eval: Evaluating Generated Regular Expressions and their Proneness to DoS (ICSE 2024) ↗ — International Conference on Software Engineering (ICSE) · A benchmark of real user regular-expression requests scores generated patterns on whether they work and on whether they are open to denial of service (search excerpt, page not opened)

    A short research paper that proposes a way to score generated patterns. It is not advice for a team. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

  4. Market practice

    Test::Regexp (Perl module documentation) ↗ — MetaCPAN · It is important to test which strings do not match a regular expression as well as which do (search excerpt, page not opened)

    Documentation for one test module in one language, used for the general habit of testing non-matches. · Checked 2026-10-18

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.