减去2 hstore,您可能需要添加显式类型强制转换 [英] Substract 2 hstore, You might need to add explicit type casts

查看:90
本文介绍了减去2 hstore,您可能需要添加显式类型强制转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

postgres的文档具有hstore-hstore,可从左操作数中删除匹配对。已安装的postgres扩展。

Documentation for postgres has hstore - hstore which delete matching pairs from left operand. Installed postgres extensions.

当我尝试

select public.hstore('"x"=>"30", "y"=>"c"') - 
       public.hstore('"x"=>"30","y"=>"fred"')

在以下

ERROR:  operator does not exist: public.hstore - public.hstore
LINE 3:  select public.hstore('"x"=>"30", "y"=>"c"') - public.hstore...
                                                     ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


推荐答案

您已经安装了 hstore 扩展到 public 模式中,该模式不在您的 search_path 中。要找到类型,您需要对它们进行模式限定,但不限定适用于操作符的- 运算符

You've installed the hstore extension into the public schema, which is not on your search_path. To find the types you're schema-qualifying them but you're not qualifying the - operator that works on those types.

这意味着将找不到 hstore 的运算符定义。您必须:

This means that hstore's operator definitions will not be found. You must:


  • 使用 OPERATOR(public .-)对模式进行限定;

  • public 放在 search_path 上;或

  • 卸载 hstore ,然后将其安装到在<$ c上的专用模式中$ c> search_path 。

  • Schema-qualify the operator using OPERATOR(public.-);
  • Put public on the search_path; or
  • Uninstall hstore and then install it into its own dedicated schema that is on the search_path.

模式限定的运算符语法的示例为:

An example of schema-qualified operator syntax is:

SELECT 1 OPERATOR(pg_catalog.-) 2;

这篇关于减去2 hstore,您可能需要添加显式类型强制转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆