3240
MariaDBWARNINGNotableGIS / GeometryHIGH confidence
Too few records returned by subquery
Production Risk
Low — warning only, but geometry aggregate may return NULL unexpectedly.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ST_Collect(geom) FROM (SELECT geom FROM spatial_table WHERE 1=0) sub;
expected output
Warning 3240: Too few records returned by subquery.
Fix
Check subquery filter
Check subquery filter
SELECT ST_Collect(geom) FROM (SELECT geom FROM spatial_table) sub;
Why this works
Remove overly restrictive WHERE clause so subquery returns the needed rows.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3240 ER_WARN_TOO_FEW_RECORDS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev