{"id":"6b56a0079cd28fb1","repo":"laravel/framework","slug":"this-database-engine-does-not-support-json-overlap","errorCode":null,"errorMessage":"This database engine does not support JSON overlaps operations.","messagePattern":"This database engine does not support JSON overlaps operations\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Query/Grammars/Grammar.php","lineNumber":741,"sourceCode":"\n        return $not.$this->compileJsonOverlaps(\n            $where['column'],\n            $this->parameter($where['value'])\n        );\n    }\n\n    /**\n     * Compile a \"JSON overlaps\" statement into SQL.\n     *\n     * @param  string  $column\n     * @param  string  $value\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    protected function compileJsonOverlaps($column, $value)\n    {\n        throw new RuntimeException('This database engine does not support JSON overlaps operations.');\n    }\n\n    /**\n     * Prepare the binding for a \"JSON contains\" statement.\n     *\n     * @param  mixed  $binding\n     * @return string\n     */\n    public function prepareBindingForJsonContains($binding)\n    {\n        return json_encode($binding, JSON_UNESCAPED_UNICODE);\n    }\n\n    /**\n     * Compile a \"where JSON contains key\" clause.\n     *\n     * @param  \\Illuminate\\Database\\Query\\Builder  $query\n     * @param  array  $where","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Query/Grammars/Grammar.php#L723-L759","documentation":"The base Grammar::compileJsonOverlaps() throws because this engine has no JSON array-overlap predicate. Only MySqlGrammar (and MariaDbGrammar inheriting it) overrides compileJsonOverlaps; SQLite, Postgres, and SQL Server all fall through to the base method and throw.","triggerScenarios":"Calling whereJsonOverlaps($column, $value) (or orWhereJsonOverlaps / whereJsonDoesntOverlap) on a sqlite, pgsql, or sqlsrv connection.","commonSituations":"Storing tag arrays in a JSON column and filtering with whereJsonOverlaps, then running the same query on Postgres or SQLite. Sharing query-builder code between a MySQL production DB and a SQLite test DB.","solutions":["On Postgres use jsonb && (overlap) via whereRaw: whereRaw('meta->\\'tags\\' ?| ?', [...]).","On SQLite use a JSON_EACH/EXISTS subquery via whereRaw to test overlap.","Restrict whereJsonOverlaps usage to MySQL/MariaDB, or normalize the tag array into a related table for portable queries."],"exampleFix":"// before\n$query->whereJsonOverlaps('meta->tags', $tags);\n\n// after (Postgres portable)\nif ($query->getConnection()->getDriverName() === 'pgsql') {\n    $query->whereRaw('jsonb_exists_any((meta->\\'tags\\')::jsonb, ?)', [$tags]);\n} else {\n    $query->whereJsonOverlaps('meta->tags', $tags);\n}","handlingStrategy":"validation","validationCode":"$driver = $query->getConnection()->getDriverName();\nif ($driver === 'mysql') {\n    $query->whereJsonOverlaps('meta->tags', $tags);\n} else {\n    // Postgres: jsonb_exists_any; SQLite: JSON_EACH subquery\n    throw new \\LogicException('whereJsonOverlaps requires MySQL/MariaDB.');\n}","typeGuard":"function supportsJsonOverlaps(\\Illuminate\\Database\\Connection $connection): bool\n{\n    return $connection instanceof \\Illuminate\\Database\\MySqlConnection;\n}","tryCatchPattern":null,"preventionTips":["Normalise tag arrays into a join table for portable overlap queries.","Keep whereJsonOverlaps behind a MySQL-only code path.","Document the MySQL-only nature in the query builder helper."],"tags":["json","where-json-overlaps","database-engine","array-overlap"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}