TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JSON functions stopped working with blobs in SQLite 3.45

50 pointsby inianover 1 year ago

2 comments

o11cover 1 year ago
The most interesting part here is the constructed polyglot:<p><pre><code> with ambiguous(j) as (select &#x27;[&#x27; || char(9) || &#x27;721]&#x27;) select json_valid(j, 0x1) as &quot;RFC 8259&quot;, json_valid(cast(j as blob), 0x8) as &quot;JSONB&quot; from ambiguous; </code></pre> Also, this is an example of why dynamic typing is <i>never</i> safe, whether in a normal programming language or in your sql database. It turns out that the sqlite documentation has been lying for years and people assumed everything was fine.
评论 #39086446 未加载
评论 #39092794 未加载
alberthover 1 year ago
This an incorrect title.<p>Per this comment:<p><a href="https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;b6f940e87dd28cf8" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;b6f940e87dd28cf8</a><p>&gt; Fix your code with CASTs instead of complaining about it. You didn&#x27;t follow the documentation<p>Essentially, the person was using json incorrectly (as per documentation even prior to this release) and now this version of SQLite is causing their incorrect code to not behave as they wanted.<p>But because SQLite doesn’t want to break backward compatibility (even for a prior unknown bug), they are <i>considering</i> persisting the bug as seen here:<p><a href="https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;bcec95d836ad4048" rel="nofollow">https:&#x2F;&#x2F;sqlite.org&#x2F;forum&#x2F;forumpost&#x2F;bcec95d836ad4048</a>
评论 #39086679 未加载
评论 #39086120 未加载
评论 #39087639 未加载