简体   繁体   English

Postgres JSON函数传递字符串而不是对象

[英]Postgres JSON function passed string instead of object

So I've got a Postgres function in place designed to merge two JSONB objects recursively, and it works just fine on the production server but fails on my local Postgres installation. 因此,我有一个Postgres函数,该函数旨在递归合并两个JSONB对象,它在生产服务器上工作正常,但在本地Postgres安装上失败。 The function itself is written in plv8 (a v8 Javascript engine basically) and expects two arguments in JSONB format to merge; 该函数本身是用plv8 (基本上是v8 Javascript引擎)编写的,并且期望将JSONB格式的两个参数合并。 the problem is that the JSON is passed in as a string and not as an object, which essentially breaks the entire function. 问题是JSON是作为字符串而不是作为对象传递的,这实际上破坏了整个功能。

This only happens on my local computer though, a fresh Postgres 9.4.5 installation. 不过,这仅在我的本地计算机上发生,是全新的Postgres 9.4.5安装。 The production server is running 9.4.4, which shouldn't cause such a major change across versions...ideas on where to go to see what's broken here? 生产服务器正在运行9.4.4,这不应在各个版本之间造成如此大的变化...想去哪里看看这里有什么问题的想法?

EDIT: Can now confirm that reverting to 9.4.4 doesn't make this behave any differently locally 编辑:现在可以确认还原到9.4.4不会使它在本地的行为有所不同

Hard to say. 很难说。 Possibilities: 可能性:

  1. Different casts - you can define custom casts - CREATE CAST statement - try to check result of psql command \\dC *json* 不同的类型转换-您可以定义自定义类型转换CREATE CAST语句-尝试检查psql命令\\dC *json*

  2. New bug introduced in 9.4.5 9.4.5中引入的新错误

FWIW,升级到9.5对我来说似乎可以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM