live wire
▸EKOS submits 70.15% on BIRD’s hidden test and 88.33% on Mini-Dev with different Claude models; both entries are pendingBIRD submission PR #270▸MotherDuck rolls out DuckDB 2.0 with async I/O and reports faster cold reads in TPC-H and TPC-DS testsMotherDuck▸ThoughtSpot Spotter starts rolling out answer explanations for token-based results, not AgentQLThoughtSpot▸Snowflake previews Z.ai GLM 5.4 in Cortex Inference, but not in Cortex AgentsSnowflake release notes▸Removing Vietnamese diacritics cut text-to-SQL accuracy by 10.3–37.0 points across four models in an author studyLe Trung et al., Vietnamese MultiSpider artifacts▸Avelis 1.7 adds AI-built dashboards and reruns pinned exploratory SQL under each viewer’s permissionsAvelis release notes▸Aurora MySQL previews cluster groups with one routing endpoint; each query still runs on one clusterAWS What's New▸Rewind-HNSW uses 86.9% less memory than full snapshots in authors’ 20-version testsShea et al., Rewind-HNSW §5.5▸Snowflake previews pausing downstream dynamic table refreshes when data quality checks failSnowflake release notes▸BigQuery previews optional GoogleSQL optimization suggestions in its interactive SQL translatorGoogle Cloud documentation▸Snowflake extends its Tableau and Power BI dashboard migration preview to Azure deploymentsSnowflake release notes▸Google Cloud makes it generally available to unpublish Iceberg data shares from SAP Business Data CloudGoogle Cloud — BigQuery and Lakehouse documentation▸AWS previews organization-wide cost questions in Ops Agent for FinOpsAWS What's New▸Looker updates require API login credentials in the request body, not the URLGoogle Cloud — Looker documentation▸EKOS submits 70.15% on BIRD’s hidden test and 88.33% on Mini-Dev with different Claude models; both entries are pendingBIRD submission PR #270▸MotherDuck rolls out DuckDB 2.0 with async I/O and reports faster cold reads in TPC-H and TPC-DS testsMotherDuck▸ThoughtSpot Spotter starts rolling out answer explanations for token-based results, not AgentQLThoughtSpot▸Snowflake previews Z.ai GLM 5.4 in Cortex Inference, but not in Cortex AgentsSnowflake release notes▸Removing Vietnamese diacritics cut text-to-SQL accuracy by 10.3–37.0 points across four models in an author studyLe Trung et al., Vietnamese MultiSpider artifacts▸Avelis 1.7 adds AI-built dashboards and reruns pinned exploratory SQL under each viewer’s permissionsAvelis release notes▸Aurora MySQL previews cluster groups with one routing endpoint; each query still runs on one clusterAWS What's New▸Rewind-HNSW uses 86.9% less memory than full snapshots in authors’ 20-version testsShea et al., Rewind-HNSW §5.5▸Snowflake previews pausing downstream dynamic table refreshes when data quality checks failSnowflake release notes▸BigQuery previews optional GoogleSQL optimization suggestions in its interactive SQL translatorGoogle Cloud documentation▸Snowflake extends its Tableau and Power BI dashboard migration preview to Azure deploymentsSnowflake release notes▸Google Cloud makes it generally available to unpublish Iceberg data shares from SAP Business Data CloudGoogle Cloud — BigQuery and Lakehouse documentation▸AWS previews organization-wide cost questions in Ops Agent for FinOpsAWS What's New▸Looker updates require API login credentials in the request body, not the URLGoogle Cloud — Looker documentation
nl2sql.ai
guideSQL guide

PostgreSQL LIKE can count the wrong campaigns when a prefix contains an underscore

A query for campaign names beginning with paid_ can also pull in paid-search. The fix is to distinguish a literal prefix from a SQL pattern.

By The News Desk· Nov 30, 2026the quick take — two AI hosts go live when you do

An analyst asks a SQL assistant for signups from campaigns whose names start with paid_. The assistant writes WHERE campaign LIKE 'paid_%'. That looks like a prefix filter, but in PostgreSQL it also admits paid-search and paidXsearch. If those names belong to other reporting buckets, the signup count can be wrong even though the SQL runs successfully.

PostgreSQL’s pattern-matching reference spells out why: _ matches exactly one character and % matches zero or more. So the generated query asks for paid, followed by any one character, followed by any suffix. It does not require an underscore. The error is in translating the analyst’s intent, not in the database’s execution.

Use a prefix test when the prefix is literal

PostgreSQL’s reference points to starts_with() for this case. If the report is built around the naming convention, write WHERE starts_with(campaign, 'paid_'). If a query builder needs to use LIKE, write WHERE campaign LIKE 'paid!_%' ESCAPE '!'. The explicit escape makes _ literal and leaves the final % as a wildcard. A parameterized LIKE filter still interprets wildcard characters in the bound pattern: binding the text paid_% does not change what _ means. For a user-supplied literal prefix, binding it as the second argument to starts_with() avoids building a pattern at all.

Test the nearest wrong match

Consider a fixture with one signup each for paid_search, paid-search, paidXsearch, and paid. The unescaped pattern counts three signups; the literal prefix counts one. These are expected results derived from the documented matching rules, not a production measurement. Notice that paid matches neither filter: even the unescaped _ requires one more character.

For a regression test, ask the assistant for campaigns beginning with the literal text paid_ and assert that only paid_search comes back. Include a near match such as paid-search; a fixture containing only correctly named campaigns can let both versions of the SQL pass. What matters is not whether the assistant uses a particular function, but whether the rows match the naming rule the analyst intended.

Filed by The News Desk. Corrections: desk@nl2sql.ai · Our standards →

comments · 0

    Comments are moderated before they appear. Your email is used once to confirm it is you — never shown, never sold. Corrections and questions get an answer from the desk when we have one.