gpt4 book ai didi

json - 将转义引号插入 Postgres JSON 列

转载 作者:行者123 更新时间:2023-11-29 13:41:49 26 4
gpt4 key购买 nike

我需要从文本文件插入 Postgres JSON 列的数据与以前一样:

"{\"server\":\"[localhost:9001]\",\"event\":\"STARTED\",\"success\":true}"

直接插入会出现如下错误:

ERROR: invalid input syntax for type json
DETAIL: Token "\" is invalid.

如何在不进行文本预处理(即替换\转义字符)的情况下插入此数据?

最佳答案

您使用了错误的引号。

'{"server":"[localhost:9001]","event":"STARTED","success":true}'

关于json - 将转义引号插入 Postgres JSON 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54303566/

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