在postgresql中按boxcolumn排序查询
在pgsql 9.1上,我很难从包含BOX类型列的表中进行选择在postgresql中按boxcolumn排序查询,postgresql,postgresql-9.1,Postgresql,Postgresql 9.1,在pgsql 9.1上,我很难从包含BOX类型列的表中进行选择 create table test (t box); CREATE TABLE select * from test order by t; ERROR: could not identify an ordering operator for type box LINE 1: select * from test order by t; ^ TIP: Us
create table test (t box);
CREATE TABLE
select * from test order by t;
ERROR: could not identify an ordering operator for type box
LINE 1: select * from test order by t;
^
TIP: Use an explicit ordering operator or modify the query.
我发现有一类运算符(box_ops)应该负责排序和相等,甚至尝试为列创建显式索引
create index testx on test using gist (t box_ops);
CREATE INDEX
但问题仍然存在。我错过了什么?
谢谢 必须显式指定运算符。例如:
SELECT * FROM test ORDER BY t USING &<
使用t从测试顺序中选择*&<
您必须决定实际需要的排序,并选择相应的比较运算符
框中定义的运算符可在
另请参见:您想要达到的结果是什么?如果成功,您创建的表应该是什么样子的?问题是关于对框列进行排序的是PostgreSqlThank,它解决了部分问题!现在我只需要再进一步:当我在一个有框行的表中执行union select时,即使我没有按这些行中的任何一行排序或分组,我也会得到运算符错误。有没有办法指定pgsql隐式使用的运算符?