From 796de9c1ed3d2cfc074c3cdbe9a12c698cd53336 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 25 Jul 2006 23:23:45 +0000 Subject: /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 --- contrib/cube/sql/cube.sql | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'contrib/cube/sql') 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 @@ -110,6 +110,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; -- cgit v1.2.3