summaryrefslogtreecommitdiff
path: root/contrib/cube/sql
diff options
context:
space:
mode:
authorBruce Momjian2006-07-25 23:23:45 +0000
committerBruce Momjian2006-07-25 23:23:45 +0000
commit796de9c1ed3d2cfc074c3cdbe9a12c698cd53336 (patch)
tree0e139fdedde2cc9b2f684d677a1f3d95decb4ccc /contrib/cube/sql
parente6284649b9e30372b3990107a082bc7520325676 (diff)
/contrib/cube improvements:
Update the calling convention for all external facing functions. By external facing, I mean all functions that are directly referenced in cube.sql. Prior to my update, all functions used the older V0 calling convention. They now use V1. New Functions: cube(float[]), which makes a zero volume cube from a float array cube(float[], float[]), which allows the user to create a cube from two float arrays; one for the upper right and one for the lower left coordinate. cube_subset(cube, int4[]), to allow you to reorder or choose a subset of dimensions from a cube, using index values specified in the array. Joshua Reich
Diffstat (limited to 'contrib/cube/sql')
-rw-r--r--contrib/cube/sql/cube.sql14
1 files changed, 12 insertions, 2 deletions
diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql
index 0b22fd768d..fbfb11ed39 100644
--- a/contrib/cube/sql/cube.sql
+++ b/contrib/cube/sql/cube.sql
@@ -111,6 +111,16 @@ SELECT cube(cube(cube(1,2),3,4),5,6);
SELECT '(0)'::text::cube;
--
+-- Test the float[] -> cube cast
+--
+SELECT cube('{0,1,2}'::float[], '{3,4,5}'::float[]);
+SELECT cube('{0,1,2}'::float[], '{3}'::float[]);
+SELECT cube(NULL::float[], '{3}'::float[]);
+SELECT cube('{0,1,2}'::float[]);
+SELECT cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1]);
+SELECT cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[4,0]);
+
+--
-- Testing limit of CUBE_MAX_DIM dimensions check in cube_in.
--
@@ -269,7 +279,7 @@ CREATE TABLE test_cube (c cube);
\copy test_cube from 'data/test_cube.data'
CREATE INDEX test_cube_ix ON test_cube USING gist (c);
-SELECT * FROM test_cube WHERE c && '(3000,1000),(0,0)';
+SELECT * FROM test_cube WHERE c && '(3000,1000),(0,0)' ORDER BY c;
-- Test sorting
-SELECT * FROM test_cube WHERE c && '(3000,1000),(0,0)' GROUP BY c;
+SELECT * FROM test_cube WHERE c && '(3000,1000),(0,0)' GROUP BY c ORDER BY c;