⌘+k ctrl+k
1.4 (LTS)
搜索快捷键 cmd + k | ctrl + k
注意事项

相等性比较

警告:目前,JSON 文件的相等性比较可能会根据上下文的不同而有所差异。在某些情况下,它基于原始文本进行比较,而在另一些情况下,它则使用逻辑内容进行比较。

以下查询对所有字段均返回 true

SELECT
    a != b, -- Space is part of physical JSON content. Despite equal logical content, values are treated as not equal.
    c != d, -- Same.
    c[0] = d[0], -- Equality because space was removed from physical content of fields:
    a = c[0], -- Indeed, field is equal to empty list without space...
    b != c[0], -- ... but different from empty list with space.
FROM (
    SELECT
        '[]'::JSON AS a,
        '[ ]'::JSON AS b,
        '[[]]'::JSON AS c,
        '[[ ]]'::JSON AS d
    );
(a != b) (c != d) (c[0] = d[0]) (a = c[0]) (b != c[0])
true true true true true
© 2025 DuckDB 基金会,阿姆斯特丹,荷兰
行为准则 商标使用指南