mirror of
https://github.com/postgres/postgres.git
synced 2026-02-12 23:33:27 -05:00
datatype by array_eq and array_cmp; use this to solve problems with memory leaks in array indexing support. The parser's equality_oper and ordering_oper routines also use the cache. Change the operator search algorithms to look for appropriate btree or hash index opclasses, instead of assuming operators named '<' or '=' have the right semantics. (ORDER BY ASC/DESC now also look at opclasses, instead of assuming '<' and '>' are the right things.) Add several more index opclasses so that there is no regression in functionality for base datatypes. initdb forced due to catalog additions.
45 lines
1 KiB
SQL
45 lines
1 KiB
SQL
--
|
|
-- CIRCLE
|
|
--
|
|
|
|
CREATE TABLE CIRCLE_TBL (f1 circle);
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
|
|
|
|
-- bad values
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
|
|
|
|
INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
|
|
|
|
SELECT * FROM CIRCLE_TBL;
|
|
|
|
SELECT '' AS six, center(f1) AS center
|
|
FROM CIRCLE_TBL;
|
|
|
|
SELECT '' AS six, radius(f1) AS radius
|
|
FROM CIRCLE_TBL;
|
|
|
|
SELECT '' AS six, diameter(f1) AS diameter
|
|
FROM CIRCLE_TBL;
|
|
|
|
SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
|
|
|
|
SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10;
|
|
|
|
SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance
|
|
FROM CIRCLE_TBL c1, CIRCLE_TBL c2
|
|
WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
|
|
ORDER BY distance, one USING < , two USING < ;
|