【问题标题】:jsonb function does not exist in greenplumjsonb函数在greenplum中不存在
【发布时间】:2020-01-30 01:06:41
【问题描述】:

在将 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.

是否可以通用地覆盖这个函数?

  • Ubuntu-Server 18.04
  • Greenplum 数据库:6.3.0

【问题讨论】:

    标签: sql jsonb greenplum hl7-fhir


    【解决方案1】:

    docs for fhirbase 说“任何高于 9.6 的版本都可以”,所以看起来您的 Postgresql 版本不受支持。原因之一是函数jsonb_build_object() 是在Postgresql9.5 中引入的。

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

    jsonb_build_object 的源代码在jsonb.c,所以我猜它可能可以反向移植,但由于 9.4 的最后一个版本将是next month,因此升级可能是更好的选择。

    【讨论】:

    • 升级 postgres 不是一个可行的选择,但是做这个反向端口可能是一个选择,但我不知道该怎么做。它只是复制文件还是我必须进行任何更改?
    • 我提到的代码是用 C 语言编写的,因此反向移植比复制文件需要更多的工作。请注意,Greenplum 似乎正在处理merging with PostgreSQL 9.6,因此下一个版本可能会包含该功能。
    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 2015-06-06
    • 2015-06-11
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    相关资源
    最近更新 更多