在多维数据集数据类型列上执行Postgresql查询时出错

问题描述 投票:0回答:1

我是Postgesql的新手。我创建了一个表,该表具有名为(Id integer, name text, url text, vector cube)的字段images

现在,我想使用<->(欧式距离)运算符将K个最接近的值搜索到一个新的多维数据集变量。我的查询如下(我假设数据列为3D):

Select * 
from images 
order by vector <-> cube(array[0.5, 0.3, 0.2]) 
limit 5

但是发生以下错误:

ERROR:  operator does not exist: cube <-> cube
LINE 1: Select * from test order by data <-> cube(array[0.5, 0.3, 0.2...
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
SQL state: 42883
Character: 38

请帮帮我。谢谢。我正在使用Ubuntu 16.04.6 LTS和Postgresql版本9.5.19。

下面是我的桌子的屏幕截图和错误:

enter image description here

enter image description here

postgresql postgresql-9.5
1个回答
1
投票

postgres 9.5中的cube扩展名没有<->运算符。您可以改用cube_distance。以下是相关文档:

https://www.postgresql.org/docs/9.5/cube.html

© www.soinside.com 2019 - 2024. All rights reserved.