1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Code and docs review for cube kNN support.

Commit 33bd250f6c could have done with
some more review:

Adjust coding so that compilers unfamiliar with elog/ereport don't complain
about uninitialized values.

Fix misuse of PG_GETARG_INT16 to retrieve arguments declared as "integer"
at the SQL level.  (This was evidently copied from cube_ll_coord and
cube_ur_coord, but those were wrong too.)

Fix non-style-guide-conforming error messages.

Fix underparenthesized if statements, which pgindent would have made a
hash of, and remove some unnecessary parens elsewhere.

Run pgindent over new code.

Revise documentation: repeated accretion of more operators without any
rethinking of the text already there had left things in a bit of a mess.
Merge all the cube operators into one table and adjust surrounding text
appropriately.

David Rowley and Tom Lane
This commit is contained in:
Tom Lane
2015-12-28 14:39:09 -05:00
parent ac443d1034
commit 81ee726d87
6 changed files with 190 additions and 201 deletions

View File

@ -1458,13 +1458,13 @@ SELECT cube(array[10,20,30], array[40,50,60])->6;
(1 row)
SELECT cube(array[10,20,30], array[40,50,60])->0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->7;
ERROR: Cube index out of bounds
ERROR: cube index 7 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-1;
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
SELECT cube(array[10,20,30])->3;
?column?
----------
@ -1478,7 +1478,7 @@ SELECT cube(array[10,20,30])->6;
(1 row)
SELECT cube(array[10,20,30])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
-- "normalized" coordinate access
SELECT cube(array[10,20,30], array[40,50,60])~>1;
?column?
@ -1517,7 +1517,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>3;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[40,50,60], array[10,20,30])~>4;
?column?
----------
@ -1525,7 +1525,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>4;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>(-1);
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
-- Load some example data and build the index
--
CREATE TABLE test_cube (c cube);

View File

@ -1458,13 +1458,13 @@ SELECT cube(array[10,20,30], array[40,50,60])->6;
(1 row)
SELECT cube(array[10,20,30], array[40,50,60])->0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->7;
ERROR: Cube index out of bounds
ERROR: cube index 7 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-1;
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
SELECT cube(array[10,20,30])->3;
?column?
----------
@ -1478,7 +1478,7 @@ SELECT cube(array[10,20,30])->6;
(1 row)
SELECT cube(array[10,20,30])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
-- "normalized" coordinate access
SELECT cube(array[10,20,30], array[40,50,60])~>1;
?column?
@ -1517,7 +1517,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>3;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[40,50,60], array[10,20,30])~>4;
?column?
----------
@ -1525,7 +1525,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>4;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>(-1);
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
-- Load some example data and build the index
--
CREATE TABLE test_cube (c cube);

View File

@ -1458,13 +1458,13 @@ SELECT cube(array[10,20,30], array[40,50,60])->6;
(1 row)
SELECT cube(array[10,20,30], array[40,50,60])->0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->7;
ERROR: Cube index out of bounds
ERROR: cube index 7 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-1;
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
SELECT cube(array[10,20,30])->3;
?column?
----------
@ -1478,7 +1478,7 @@ SELECT cube(array[10,20,30])->6;
(1 row)
SELECT cube(array[10,20,30])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
-- "normalized" coordinate access
SELECT cube(array[10,20,30], array[40,50,60])~>1;
?column?
@ -1517,7 +1517,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>3;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[40,50,60], array[10,20,30])~>4;
?column?
----------
@ -1525,7 +1525,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>4;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>(-1);
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
-- Load some example data and build the index
--
CREATE TABLE test_cube (c cube);

View File

@ -1458,13 +1458,13 @@ SELECT cube(array[10,20,30], array[40,50,60])->6;
(1 row)
SELECT cube(array[10,20,30], array[40,50,60])->0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->7;
ERROR: Cube index out of bounds
ERROR: cube index 7 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-1;
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
SELECT cube(array[10,20,30], array[40,50,60])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
SELECT cube(array[10,20,30])->3;
?column?
----------
@ -1478,7 +1478,7 @@ SELECT cube(array[10,20,30])->6;
(1 row)
SELECT cube(array[10,20,30])->-6;
ERROR: Cube index out of bounds
ERROR: cube index -6 is out of bounds
-- "normalized" coordinate access
SELECT cube(array[10,20,30], array[40,50,60])~>1;
?column?
@ -1517,7 +1517,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>3;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>0;
ERROR: Cube index out of bounds
ERROR: cube index 0 is out of bounds
SELECT cube(array[40,50,60], array[10,20,30])~>4;
?column?
----------
@ -1525,7 +1525,7 @@ SELECT cube(array[40,50,60], array[10,20,30])~>4;
(1 row)
SELECT cube(array[40,50,60], array[10,20,30])~>(-1);
ERROR: Cube index out of bounds
ERROR: cube index -1 is out of bounds
-- Load some example data and build the index
--
CREATE TABLE test_cube (c cube);