jsonb 函数在 greenplum 中不存在

jsonb function does not exist in greenplum

将 fhirbase 模式导入 Greenplum 数据库时,出现错误,其中一个必需的函数需要另一个数据库中不存在的函数:

CREATE OR REPLACE FUNCTION _fhirbase_to_resource(x _resource)
RETURNS jsonb AS $$
 select x.resource || jsonb_build_object(
  'resourceType', x.resource_type,
  'id', x.id,
  'meta', coalesce(x.resource->'meta', '{}'::jsonb) || jsonb_build_object(
    'lastUpdated', x.ts,
    'versionId', x.txid::text
  )
 );
$$ LANGUAGE sql;

它返回错误和提示:

LINE 6: ...ta', coalesce(x.resource->'meta', '{}'::jsonb) || jsonb_buil...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

是否可以通用覆盖此功能?

docs for fhirbase say "Any version above 9.6 should be fine" so it looks like your version of Postgresql is not supported. One reason for this is that the function jsonb_build_object() was introduced in Postgresql9.5

是否可以升级到 Postgresql 9.6 或更高版本?

jsonb_build_object 的源代码在 jsonb.c so I guess it may be possible to back port it but as the last release for 9.4 will be next month 升级可能是更好的选择。