prorm API Reference
    Preparing search index...

    Function sqlJsonHasKey

    • Does the JSON object in expr have the given top-level (or path-qualified, dotted) key?

      • mysql/mariadb: JSON_CONTAINS_PATH(col, 'one', '$.key') (matches buildJsonHasKey in src/dialects/{mysql,mariadb}/index.ts).
      • postgres/cockroachdb: native ? key-existence operator -> col ? 'key' (top-level keys only, matching jsonb semantics).
      • sqlite: json_extract(col, '$.key') IS NOT NULL (matches buildJsonHasKey in src/dialects/sqlite/index.ts).
      • mssql: JSON_VALUE(col, '$.key') IS NOT NULL (standard SQL Server workaround pattern; note this cannot distinguish "key present with a JSON null value" from "key absent").
      • oracle: JSON_EXISTS(col, '$.key').
      • snowflake: ARRAY_CONTAINS('key'::VARIANT, OBJECT_KEYS(col)).
      • redshift: SUPER dot-navigation returns SQL NULL for missing attributes, so col.key IS NOT NULL reliably detects key presence.
      • db2: JSON_EXISTS(col, '$.key') (Db2 11.5+ JSON path predicates).
      • clickhouse: JSONHas(col, 'key').

      Parameters

      Returns { $literal: string }