【问题标题】:Sqlite Error: Expression tree is too large (maximum depth 1000)Sqlite 错误:表达式树太大(最大深度 1000)
【发布时间】:2017-03-31 16:05:52
【问题描述】:

我正在尝试对格式错误的 sqlite 文件进行干净的导出-导入。

使用来自techblog.dorogin.com/sqliteexception-datab... 的信息,这就是我所做的sqlite3 oldfile

  1. .mode insert
  2. .output tempfile
  3. .dump

然后我创建了一个新的sqlite3 newfile

  • .read tempfile

错误:

sqlite> .read tempfile
Error: near line 52330: Expression tree is too large (maximum depth 1000)
Error: near line 53097: Expression tree is too large (maximum depth 1000)
Error: near line 53427: Expression tree is too large (maximum depth 1000)
Error: near line 54013: Expression tree is too large (maximum depth 1000)
Error: near line 54014: Expression tree is too large (maximum depth 1000)
Error: near line 54047: Expression tree is too large (maximum depth 1000)
Error: near line 54048: Expression tree is too large (maximum depth 1000)
Error: near line 54227: Expression tree is too large (maximum depth 1000)
Error: near line 54294: Expression tree is too large (maximum depth 1000)
Error: near line 54373: Expression tree is too large (maximum depth 1000)
Error: near line 54374: Expression tree is too large (maximum depth 1000)
Error: near line 56688: Expression tree is too large (maximum depth 1000)
Error: near line 57950: Expression tree is too large (maximum depth 1000)
Error: near line 58015: Expression tree is too large (maximum depth 1000)
Error: near line 58077: Expression tree is too large (maximum depth 1000)
Error: near line 58246: Expression tree is too large (maximum depth 1000)
Error: near line 59795: Expression tree is too large (maximum depth 1000)
Error: near line 60439: Expression tree is too large (maximum depth 1000)
Error: near line 61501: Expression tree is too large (maximum depth 1000)
Error: near line 61523: Expression tree is too large (maximum depth 1000)
Error: near line 61811: Expression tree is too large (maximum depth 1000)
Error: near line 61824: Expression tree is too large (maximum depth 1000)

在输出文件中,我的最大行是 35737 个字符。

我该如何解决这个错误?

有哪些解决方案可以对格式错误的 sqlite 文件进行干净的导出-导入?

【问题讨论】:

  • 你用谷歌搜索过吗?看起来它在一个查询中出现了超过 1000 个条件
  • @juergend,是的,我需要一个解决方案。
  • 显示违规行之一。
  • @CL.,有很多很多行。采样线:INSERT INTO NotesData_content VALUES(3981,'..redact..','=='||char(10)||'..redact..'||char(10)||'=='||char(10)||'..redact..'||char(10)||'=='||char(10)||'..redact..'||char(10)|| ....................||'..redact..');
  • 如果 Google 将您发送到此处:该错误意味着您的 SELECT 语句太复杂。这个stackoverflow.com/questions/50390108/… 解释了为什么会发生这种情况。

标签: database sqlite backup restore


【解决方案1】:

这是由于版本 3.18.0 中的changesqlite3

在 CLI 中“.dump”命令的输出中,使用 char() 函数引用换行符和回车符,这样它们就不会被操作系统中的行尾处理逻辑吃掉,或者在其他命令行实用程序和/或库中。

如果单个字符串值中有太多换行符,则生成的 SQL 表达式会变得过于复杂。

这是版本 3.19.0 中的 fixed。 如果您仍在使用 3.18.0,则可以通过将文件转换为使用原始换行符来解决此问题:

sed -e "s/'||char(10)||'/\\n/g" < tempfile > tempfile_with_newlines

【讨论】:

  • 酷,他们是不是因为这个线程报告而在 3.19 中修复了它?
  • 是的;基于此的错误报告是第一个。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-23
  • 2014-02-03
  • 2022-01-04
  • 1970-01-01
  • 2011-02-04
  • 2015-02-12
相关资源
最近更新 更多