diff options
| author | Bruce Momjian | 2006-07-25 23:23:45 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2006-07-25 23:23:45 +0000 |
| commit | 796de9c1ed3d2cfc074c3cdbe9a12c698cd53336 (patch) | |
| tree | 0e139fdedde2cc9b2f684d677a1f3d95decb4ccc /contrib/cube/expected | |
| parent | e6284649b9e30372b3990107a082bc7520325676 (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/expected')
| -rw-r--r-- | contrib/cube/expected/cube.out | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out index 578d27be7f8..57dbc56c711 100644 --- a/contrib/cube/expected/cube.out +++ b/contrib/cube/expected/cube.out @@ -8,7 +8,9 @@ \set ECHO none psql:cube.sql:10: NOTICE: type "cube" is not yet defined DETAIL: Creating a shell type definition. -psql:cube.sql:15: NOTICE: argument type cube is only a shell +psql:cube.sql:14: NOTICE: return type cube is only a shell +psql:cube.sql:18: NOTICE: return type cube is only a shell +psql:cube.sql:23: NOTICE: argument type cube is only a shell -- -- testing the input and output functions -- @@ -396,6 +398,37 @@ SELECT '(0)'::text::cube; (1 row) -- +-- Test the float[] -> cube cast +-- +SELECT cube('{0,1,2}'::float[], '{3,4,5}'::float[]); + cube +--------------------- + (0, 1, 2),(3, 4, 5) +(1 row) + +SELECT cube('{0,1,2}'::float[], '{3}'::float[]); +ERROR: UR and LL arrays must be of same length +SELECT cube(NULL::float[], '{3}'::float[]); + cube +------ + +(1 row) + +SELECT cube('{0,1,2}'::float[]); + cube +----------- + (0, 1, 2) +(1 row) + +SELECT cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1]); + cube_subset +--------------------------- + (5, 3, 1, 1),(8, 7, 6, 6) +(1 row) + +SELECT cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[4,0]); +ERROR: Index out of bounds +-- -- Testing limit of CUBE_MAX_DIM dimensions check in cube_in. -- select '(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)'::cube; @@ -1021,24 +1054,24 @@ SELECT cube_enlarge('(2,-2),(-3,7)'::cube, -3, 2); 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; c -------------------------- - (2424, 160),(2424, 81) - (759, 187),(662, 163) - (1444, 403),(1346, 344) - (337, 455),(240, 359) (1594, 1043),(1517, 971) + (337, 455),(240, 359) + (1444, 403),(1346, 344) + (759, 187),(662, 163) + (2424, 160),(2424, 81) (5 rows) -- 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; c -------------------------- + (1594, 1043),(1517, 971) (337, 455),(240, 359) - (759, 187),(662, 163) (1444, 403),(1346, 344) - (1594, 1043),(1517, 971) + (759, 187),(662, 163) (2424, 160),(2424, 81) (5 rows) |
