gpt4 book ai didi

postgresql insert on conflict triggers attempted to delete invisible tuple 错误

转载 作者:行者123 更新时间:2023-11-29 12:36:11 25 4
gpt4 key购买 nike

我有时会在两次插入相同数据时在我的日志中看到以下错误:

error: attempted to delete invisible tuple
at Connection.parseE (/home/ubuntu/vacation-server/node_modules/pg/lib/connection.js:554:11)
at Connection.parseMessage (/home/ubuntu/vacation-server/node_modules/pg/lib/connection.js:381:17)
at Socket.<anonymous> (/home/ubuntu/vacation-server/node_modules/pg/lib/connection.js:117:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:548:20)

我的查询如下:

    INSERT INTO google_places (
id,
data,
geographic_coordinates
) VALUES (
$1,
$2,
ST_GeomFromText('POINT(-118.440908 34.063246)', 4326)
)
ON CONFLICT (id) DO UPDATE
SET data = EXCLUDED.data,
geographic_coordinates = EXCLUDED.geographic_coordinates,
date_updated = CURRENT_TIMESTAMP
RETURNING *

有什么想法吗?

最佳答案

在 9.5.5 之前的版本中,升级 TOAST 数据会在某些特定情况下引发此异常。我遇到了基于函数索引的冲突键(特别是 ON CONFLICT (md5(myblob)) DO UPDATE),但这是同样的错误。

This thread来自邮件列表有完整的细节。该错误已在 9.5.5 和 9.6 中得到修复,但我不知道对于早期版本的 Postgres 有任何简单的解决方法。我最终不得不使用旧式 CTE upsert。

关于postgresql insert on conflict triggers attempted to delete invisible tuple 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41049664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com