BEGIN; -- bigistore functions should find keys with exists; -- ./spec/istore/functions_plain_spec.rb:10; CREATE EXTENSION istore; SELECT exist('1=>1'::bigistore, 1); exist ------- t (1 row) SELECT exist('1=>1'::bigistore, 2); exist ------- f (1 row) SELECT exist('1=>1, -1=>0'::bigistore, 2); exist ------- f (1 row) SELECT exist('1=>1, -1=>0'::bigistore, -1); exist ------- t (1 row) ROLLBACK; BEGIN; -- bigistore functions should fetchvals; -- ./spec/istore/functions_plain_spec.rb:17; CREATE EXTENSION istore; SELECT fetchval('1=>1'::bigistore, 1); fetchval ---------- 1 (1 row) SELECT fetchval('2=>1'::bigistore, 1); fetchval ---------- (1 row) SELECT fetchval('1=>1, 1=>1'::bigistore, 1); fetchval ---------- 2 (1 row) SELECT fetchval('1=>1, 1=>1'::bigistore, 2); fetchval ---------- (1 row) ROLLBACK; BEGIN; -- bigistore functions should return set of ints; -- ./spec/istore/functions_plain_spec.rb:24; CREATE EXTENSION istore; SELECT * FROM each('1=>1'::bigistore); key | value -----+------- 1 | 1 (1 row) SELECT * FROM each('5=>11, 4=>8'::bigistore); key | value -----+------- 4 | 8 5 | 11 (2 rows) SELECT * FROM each('5=>-411, 4=>8'::bigistore); key | value -----+------- 4 | 8 5 | -411 (2 rows) SELECT value + 100 FROM each('5=>-411, 4=>8'::bigistore); ?column? ---------- 108 -311 (2 rows) SELECT * FROM each('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); key | value -------------+---------------------- -2147483647 | 10 -10 | -9223372036854775807 0 | 5 10 | 9223372036854775806 2147483647 | 10 (5 rows) SELECT * FROM each(NULL::bigistore); key | value -----+------- (0 rows) ROLLBACK; BEGIN; -- bigistore functions should compact istores; -- ./spec/istore/functions_plain_spec.rb:49; CREATE EXTENSION istore; SELECT compact('0=>2, 1=>2, 3=>0 ,2=>2'::bigistore); compact ------------------------------ "0"=>"2", "1"=>"2", "2"=>"2" (1 row) ROLLBACK; BEGIN; -- bigistore functions should add istores; -- ./spec/istore/functions_plain_spec.rb:54; CREATE EXTENSION istore; SELECT add('1=>1, 2=>1'::bigistore, '1=>1, 2=>1'::bigistore); add -------------------- "1"=>"2", "2"=>"2" (1 row) SELECT add('1=>1, 2=>1'::bigistore, '-1=>1, 2=>1'::bigistore); add ------------------------------- "-1"=>"1", "1"=>"1", "2"=>"2" (1 row) SELECT add('1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); add -------------------------------- "-1"=>"-1", "1"=>"1", "2"=>"2" (1 row) SELECT add('-1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); add --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); add ---------------------- "-1"=>"-2", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::bigistore, 1); add --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::bigistore, -1); add ---------------------- "-1"=>"-2", "2"=>"0" (1 row) SELECT add('-1=>-1, 2=>1'::bigistore, 0); add ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT add(bigistore(Array[]::integer[], Array[]::integer[]), '1=>0'::bigistore);; add ---------- "1"=>"0" (1 row) ROLLBACK; BEGIN; -- bigistore functions should substract istores; -- ./spec/istore/functions_plain_spec.rb:75; CREATE EXTENSION istore; SELECT subtract('1=>1, 2=>1'::bigistore, '1=>1, 2=>1'::bigistore); subtract -------------------- "1"=>"0", "2"=>"0" (1 row) SELECT subtract('1=>1, 2=>1'::bigistore, '-1=>1, 2=>1'::bigistore); subtract -------------------------------- "-1"=>"-1", "1"=>"1", "2"=>"0" (1 row) SELECT subtract('1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); subtract ------------------------------- "-1"=>"1", "1"=>"1", "2"=>"0" (1 row) SELECT subtract('-1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); subtract --------------------- "-1"=>"2", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); subtract --------------------- "-1"=>"0", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::bigistore, 1); subtract ---------------------- "-1"=>"-2", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::bigistore, -1); subtract --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT subtract('-1=>-1, 2=>1'::bigistore, 0); subtract ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT subtract(bigistore(Array[]::integer[], Array[]::integer[]), '1=>0'::bigistore);; subtract ---------- "1"=>"0" (1 row) ROLLBACK; BEGIN; -- bigistore functions should multiply istores; -- ./spec/istore/functions_plain_spec.rb:96; CREATE EXTENSION istore; SELECT multiply('1=>1, 2=>1'::bigistore, '1=>1, 2=>1'::bigistore); multiply -------------------- "1"=>"1", "2"=>"1" (1 row) SELECT multiply('1=>1, 2=>1'::bigistore, '-1=>1, 2=>1'::bigistore); multiply ---------- "2"=>"1" (1 row) SELECT multiply('1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); multiply ---------- "2"=>"1" (1 row) SELECT multiply('-1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); multiply ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); multiply --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::bigistore, 1); multiply ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::bigistore, -1); multiply ---------------------- "-1"=>"1", "2"=>"-1" (1 row) SELECT multiply('-1=>-1, 2=>1'::bigistore, 0); multiply --------------------- "-1"=>"0", "2"=>"0" (1 row) ROLLBACK; BEGIN; -- bigistore functions should divide istores; -- ./spec/istore/functions_plain_spec.rb:115; CREATE EXTENSION istore; SELECT divide('1=>1, 2=>1'::bigistore, '1=>1, 2=>1'::bigistore); divide -------------------- "1"=>"1", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::bigistore, '-1=>1, 2=>1'::bigistore); divide ---------- "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); divide ---------- "2"=>"1" (1 row) SELECT divide('-1=>1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); divide ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT divide('-1=>-1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); divide --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT divide('-1=>-1, 2=>1'::bigistore, '-1=>-1, 2=>1'::bigistore); divide --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT divide('1=>0, 2=>1'::bigistore, '1=>-1, 2=>1'::bigistore); divide -------------------- "1"=>"0", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::bigistore, '1=>-1, 2=>1, 3=>0'::bigistore); divide --------------------- "1"=>"-1", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::bigistore, '3=>0'::bigistore); divide -------- (1 row) SELECT divide('-1=>-1, 2=>1'::bigistore, -1); divide ---------------------- "-1"=>"1", "2"=>"-1" (1 row) ROLLBACK; BEGIN; -- bigistore functions should raise division by zero error; -- ./spec/istore/functions_plain_spec.rb:137; CREATE EXTENSION istore; SELECT divide('-1=>-1, 2=>1'::bigistore, 0); ERROR: division by zero ROLLBACK; BEGIN; -- bigistore functions should raise division by zero error; -- ./spec/istore/functions_plain_spec.rb:141; CREATE EXTENSION istore; SELECT divide('-1=>-1, 2=>1'::bigistore, '2=>0'); ERROR: division by zero ROLLBACK; BEGIN; -- bigistore functions should generate #{type} from array; -- ./spec/istore/functions_plain_spec.rb:145; CREATE EXTENSION istore; SELECT bigistore(ARRAY[1]); bigistore ----------- "1"=>"1" (1 row) SELECT bigistore(ARRAY[1,1,1,1]); bigistore ----------- "1"=>"4" (1 row) SELECT bigistore(NULL); bigistore ----------- (1 row) SELECT bigistore(ARRAY[1,2,3,4]); bigistore ---------------------------------------- "1"=>"1", "2"=>"1", "3"=>"1", "4"=>"1" (1 row) SELECT bigistore(ARRAY[1,2,3,4,1,2,3,4]); bigistore ---------------------------------------- "1"=>"2", "2"=>"2", "3"=>"2", "4"=>"2" (1 row) SELECT bigistore(ARRAY[1,2,3,4,1,2,3,NULL]); bigistore ---------------------------------------- "1"=>"2", "2"=>"2", "3"=>"2", "4"=>"1" (1 row) SELECT bigistore(ARRAY[NULL,2,3,4,1,2,3,4]); bigistore ---------------------------------------- "1"=>"1", "2"=>"2", "3"=>"2", "4"=>"2" (1 row) SELECT bigistore(ARRAY[NULL,2,3,4,1,2,3,NULL]); bigistore ---------------------------------------- "1"=>"1", "2"=>"2", "3"=>"2", "4"=>"1" (1 row) SELECT bigistore(ARRAY[1,2,3,NULL,1,NULL,3,4,1,2,3]); bigistore ---------------------------------------- "1"=>"3", "2"=>"2", "3"=>"3", "4"=>"1" (1 row) SELECT bigistore(ARRAY[NULL,NULL,NULL,NULL]::integer[]); bigistore ----------- (1 row) SELECT bigistore(ARRAY[]::integer[]); bigistore ----------- (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum up istores; -- ./spec/istore/functions_plain_spec.rb:167; CREATE EXTENSION istore; SELECT sum_up('1=>1'::bigistore); sum_up -------- 1 (1 row) SELECT sum_up(NULL::bigistore); sum_up -------- (1 row) SELECT sum_up('1=>1, 2=>1'::bigistore); sum_up -------- 2 (1 row) SELECT sum_up('1=>1, 5=>1, 3=> 4'::bigistore, 3); sum_up -------- 5 (1 row) SELECT sum_up('1=>1 ,2=>-1, 1=>1'::bigistore); sum_up -------- 1 (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:175; CREATE EXTENSION istore; CREATE TABLE test (a bigistore); INSERT INTO test VALUES('1=>1'),('2=>1'), ('3=>1'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"1" (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:182; CREATE EXTENSION istore; CREATE TABLE test (a bigistore); INSERT INTO test VALUES('1=>1'),('2=>1'),('3=>1'),(NULL),('3=>3'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"4" (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:189; CREATE EXTENSION istore; CREATE TABLE test (a bigistore); INSERT INTO test VALUES('1=>1'),('2=>1'),('3=>1'),(NULL),('3=>0'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"1" (1 row) ROLLBACK; BEGIN; -- bigistore functions should return istores from arrays; -- ./spec/istore/functions_plain_spec.rb:196; CREATE EXTENSION istore; SELECT bigistore(Array[5,3,4,5], Array[1,2,3,4]); bigistore ------------------------------ "3"=>"2", "4"=>"3", "5"=>"5" (1 row) SELECT bigistore(Array[5,3,4,5], Array[1,2,3,4]); bigistore ------------------------------ "3"=>"2", "4"=>"3", "5"=>"5" (1 row) SELECT bigistore(Array[5,3,4,5], Array[4000,2,4000,4]); bigistore ------------------------------------ "3"=>"2", "4"=>"4000", "5"=>"4004" (1 row) SELECT bigistore(Array[5,3,4]::int[], Array[5000000000,4000000000,5]::bigint[]); bigistore ------------------------------------------------ "3"=>"4000000000", "4"=>"5", "5"=>"5000000000" (1 row) ROLLBACK; BEGIN; -- bigistore functions should fill gaps; -- ./spec/istore/functions_plain_spec.rb:211; CREATE EXTENSION istore; SELECT fill_gaps('2=>17, 4=>3'::bigistore, 5, 0); fill_gaps ------------------------------------------------------------- "0"=>"0", "1"=>"0", "2"=>"17", "3"=>"0", "4"=>"3", "5"=>"0" (1 row) SELECT fill_gaps('2=>17, 4=>3'::bigistore, 5); fill_gaps ------------------------------------------------------------- "0"=>"0", "1"=>"0", "2"=>"17", "3"=>"0", "4"=>"3", "5"=>"0" (1 row) SELECT fill_gaps('2=>17, 4=>3'::bigistore, 3, 11); fill_gaps -------------------------------------------- "0"=>"11", "1"=>"11", "2"=>"17", "3"=>"11" (1 row) SELECT fill_gaps('2=>17, 4=>3'::bigistore, 0, 0); fill_gaps ----------- "0"=>"0" (1 row) SELECT fill_gaps('2=>17'::bigistore, 3, NULL); fill_gaps ----------- (1 row) SELECT fill_gaps('2=>0, 3=>3'::bigistore, 3, 0); fill_gaps ---------------------------------------- "0"=>"0", "1"=>"0", "2"=>"0", "3"=>"3" (1 row) SELECT fill_gaps(''::bigistore, 3, 0); fill_gaps ---------------------------------------- "0"=>"0", "1"=>"0", "2"=>"0", "3"=>"0" (1 row) SELECT fill_gaps(''::bigistore, 3, 400); fill_gaps ------------------------------------------------ "0"=>"400", "1"=>"400", "2"=>"400", "3"=>"400" (1 row) SELECT fill_gaps(NULL::bigistore, 3, 0); fill_gaps ----------- (1 row) SELECT fill_gaps('2=>17, 4=>3'::bigistore, -5, 0); ERROR: parameter upto must be >= 0 ROLLBACK; BEGIN; -- bigistore functions should fill accumulate; -- ./spec/istore/functions_plain_spec.rb:240; CREATE EXTENSION istore; SELECT accumulate('2=>17, 4=>3'::bigistore); accumulate --------------------------------- "2"=>"17", "3"=>"17", "4"=>"20" (1 row) SELECT accumulate('2=>0, 4=>3'::bigistore); accumulate ------------------------------ "2"=>"0", "3"=>"0", "4"=>"3" (1 row) SELECT accumulate('1=>3, 2=>0, 4=>3, 6=>2'::bigistore); accumulate ------------------------------------------------------------ "1"=>"3", "2"=>"3", "3"=>"3", "4"=>"6", "5"=>"6", "6"=>"8" (1 row) SELECT accumulate(''::bigistore); accumulate ------------ (1 row) SELECT accumulate('10=>5'::bigistore); accumulate ------------ "10"=>"5" (1 row) SELECT accumulate(NULL::bigistore); accumulate ------------ (1 row) SELECT accumulate('-20=> 5, -10=> 5'::bigistore); accumulate ------------------------------------------------------------------------------------------------------------------------------------- "-20"=>"5", "-19"=>"5", "-18"=>"5", "-17"=>"5", "-16"=>"5", "-15"=>"5", "-14"=>"5", "-13"=>"5", "-12"=>"5", "-11"=>"5", "-10"=>"10" (1 row) SELECT accumulate('-5=> 5, 3=> 5'::bigistore); accumulate ------------------------------------------------------------------------------------------------ "-5"=>"5", "-4"=>"5", "-3"=>"5", "-2"=>"5", "-1"=>"5", "0"=>"5", "1"=>"5", "2"=>"5", "3"=>"10" (1 row) ROLLBACK; BEGIN; -- bigistore functions should fill accumulate upto; -- ./spec/istore/functions_plain_spec.rb:256; CREATE EXTENSION istore; SELECT accumulate('2=>17, 4=>3'::bigistore, 8); accumulate ----------------------------------------------------------------------------- "2"=>"17", "3"=>"17", "4"=>"20", "5"=>"20", "6"=>"20", "7"=>"20", "8"=>"20" (1 row) SELECT accumulate('2=>0, 4=>3'::bigistore, 8); accumulate ---------------------------------------------------------------------- "2"=>"0", "3"=>"0", "4"=>"3", "5"=>"3", "6"=>"3", "7"=>"3", "8"=>"3" (1 row) SELECT accumulate('1=>3, 2=>0, 4=>3, 6=>2'::bigistore, 8); accumulate -------------------------------------------------------------------------------- "1"=>"3", "2"=>"3", "3"=>"3", "4"=>"6", "5"=>"6", "6"=>"8", "7"=>"8", "8"=>"8" (1 row) SELECT accumulate(''::bigistore, 8); accumulate ------------ (1 row) SELECT accumulate('10=>5'::bigistore, 8); accumulate ------------ (1 row) SELECT accumulate('1=>5'::bigistore, 0); accumulate ------------ (1 row) SELECT accumulate(NULL::bigistore, 8); accumulate ------------ (1 row) SELECT accumulate('-20=> 5, -10=> 5'::bigistore, -8); accumulate ------------------------------------------------------------------------------------------------------------------------------------------------------------- "-20"=>"5", "-19"=>"5", "-18"=>"5", "-17"=>"5", "-16"=>"5", "-15"=>"5", "-14"=>"5", "-13"=>"5", "-12"=>"5", "-11"=>"5", "-10"=>"10", "-9"=>"10", "-8"=>"10" (1 row) SELECT accumulate('-5=> 5, 3=> 5'::bigistore, 2); accumulate ------------------------------------------------------------------------------------- "-5"=>"5", "-4"=>"5", "-3"=>"5", "-2"=>"5", "-1"=>"5", "0"=>"5", "1"=>"5", "2"=>"5" (1 row) ROLLBACK; BEGIN; -- bigistore functions should accumulate big numbers; -- ./spec/istore/functions_plain_spec.rb:273; CREATE EXTENSION istore; SELECT accumulate('0=>20000000000, 1=>10000000000, 3=>10000000000'::bigistore, 4); accumulate ---------------------------------------------------------------------------------------------------- "0"=>"20000000000", "1"=>"30000000000", "2"=>"30000000000", "3"=>"40000000000", "4"=>"40000000000" (1 row) ROLLBACK; BEGIN; -- bigistore functions should seed an #{type} from integer; -- ./spec/istore/functions_plain_spec.rb:278; CREATE EXTENSION istore; SELECT istore_seed(2,5,8::bigint); istore_seed ---------------------------------------- "2"=>"8", "3"=>"8", "4"=>"8", "5"=>"8" (1 row) SELECT istore_seed(2,5,NULL::bigint); istore_seed ------------- (1 row) SELECT istore_seed(2,5,0::bigint); istore_seed ---------------------------------------- "2"=>"0", "3"=>"0", "4"=>"0", "5"=>"0" (1 row) SELECT istore_seed(2,2,8::bigint); istore_seed ------------- "2"=>"8" (1 row) SELECT istore_seed(2,0,8::bigint); ERROR: parameter upto must be >= from ROLLBACK; BEGIN; -- bigistore functions should throw an error if negativ seed span; -- ./spec/istore/functions_plain_spec.rb:289; CREATE EXTENSION istore; SELECT istore_seed(-2,0,8); ERROR: parameter from must be >= 0 ROLLBACK; BEGIN; -- bigistore functions should merge istores by larger keys; -- ./spec/istore/functions_plain_spec.rb:293; CREATE EXTENSION istore; SELECT istore_val_larger('1=>1,2=>1,3=>3'::bigistore, '1=>2,3=>1,4=>1'); istore_val_larger ---------------------------------------- "1"=>"2", "2"=>"1", "3"=>"3", "4"=>"1" (1 row) ROLLBACK; BEGIN; -- bigistore functions should merge istores by smaller keys; -- ./spec/istore/functions_plain_spec.rb:298; CREATE EXTENSION istore; SELECT istore_val_smaller('1=>1,2=>1,3=>3'::bigistore, '1=>2,3=>1,4=>1'); istore_val_smaller ---------------------------------------- "1"=>"1", "2"=>"1", "3"=>"1", "4"=>"1" (1 row) ROLLBACK; BEGIN; -- bigistore functions should return #{type} with maxed values; -- ./spec/istore/functions_plain_spec.rb:303; CREATE EXTENSION istore; SELECT MAX(s) FROM (VALUES('1=>5, 2=>2, 3=>3'::bigistore),('1=>1, 2=>5, 3=>3'),('1=>1, 2=>4, 3=>5'))t(s); max ------------------------------ "1"=>"5", "2"=>"5", "3"=>"5" (1 row) ROLLBACK; BEGIN; -- bigistore functions should return #{type} with maxed values; -- ./spec/istore/functions_plain_spec.rb:308; CREATE EXTENSION istore; SELECT MIN(s) FROM (VALUES('1=>5, 2=>2, 3=>3'::bigistore),('1=>1, 2=>5, 3=>3'),('1=>1, 2=>4, 3=>5'))t(s); min ------------------------------ "1"=>"1", "2"=>"2", "3"=>"3" (1 row) ROLLBACK; BEGIN; -- bigistore functions should return keys as array; -- ./spec/istore/functions_plain_spec.rb:313; CREATE EXTENSION istore; SELECT akeys('-5=>10, 0=>-5, 5=>0'::bigistore); akeys ---------- {-5,0,5} (1 row) SELECT akeys(''::bigistore); akeys ------- {} (1 row) ROLLBACK; BEGIN; -- bigistore functions should return values as array; -- ./spec/istore/functions_plain_spec.rb:318; CREATE EXTENSION istore; SELECT avals('-5=>10, 0=>-5, 5=>0'::bigistore); avals ----------- {10,-5,0} (1 row) SELECT avals(''::bigistore); avals ------- {} (1 row) ROLLBACK; BEGIN; -- bigistore functions should return keys as set; -- ./spec/istore/functions_plain_spec.rb:322; CREATE EXTENSION istore; SELECT skeys('-5=>10, 0=>-5, 5=>0'::bigistore); skeys ------- -5 0 5 (3 rows) SELECT skeys(''::bigistore); skeys ------- (0 rows) ROLLBACK; BEGIN; -- bigistore functions should return values set array; -- ./spec/istore/functions_plain_spec.rb:330; CREATE EXTENSION istore; SELECT svals('-5=>10, 0=>-5, 5=>0'::bigistore); svals ------- 10 -5 0 (3 rows) SELECT svals(''::bigistore); svals ------- (0 rows) ROLLBACK; BEGIN; -- bigistore functions should sum up istores; -- ./spec/istore/functions_plain_spec.rb:338; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>10'::istore); sum_up -------- 15 (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum up istores with big numbers; -- ./spec/istore/functions_plain_spec.rb:342; CREATE EXTENSION istore; SELECT sum_up('10=>2000000000, 15=>1000000000'::istore); sum_up ------------ 3000000000 (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum up bigistores; -- ./spec/istore/functions_plain_spec.rb:346; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>10'::bigistore); sum_up -------- 15 (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum up istores with negative values; -- ./spec/istore/functions_plain_spec.rb:350; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>-10'::istore); sum_up -------- -5 (1 row) ROLLBACK; BEGIN; -- bigistore functions should sum up bigistores with negative values; -- ./spec/istore/functions_plain_spec.rb:354; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>-10'::bigistore); sum_up -------- -5 (1 row) ROLLBACK; BEGIN; -- bigistore functions should return length of empty istores; -- ./spec/istore/functions_plain_spec.rb:358; CREATE EXTENSION istore; SELECT istore_length(bigistore(ARRAY[]::integer[],ARRAY[]::integer[])); istore_length --------------- 0 (1 row) ROLLBACK; BEGIN; -- bigistore functions should return length of non-empty istores; -- ./spec/istore/functions_plain_spec.rb:362; CREATE EXTENSION istore; SELECT istore_length(bigistore(ARRAY[1],ARRAY[1])); istore_length --------------- 1 (1 row) SELECT istore_length(bigistore(ARRAY[1,2,3],ARRAY[1,2,3])); istore_length --------------- 3 (1 row) SELECT istore_length('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); istore_length --------------- 5 (1 row) ROLLBACK; BEGIN; -- bigistore functions should convert istore to json; -- ./spec/istore/functions_plain_spec.rb:368; CREATE EXTENSION istore; SELECT istore_to_json('5=>50, 7=>70, 9=>90'::bigistore); istore_to_json ----------------------------- {"5": 50, "7": 70, "9": 90} (1 row) SELECT istore_to_json('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); istore_to_json ------------------------------------------------------------------------------------------------------- {"-2147483647": 10, "-10": -9223372036854775807, "0": 5, "10": 9223372036854775806, "2147483647": 10} (1 row) ROLLBACK; BEGIN; -- bigistore functions should convert istore to array; -- ./spec/istore/functions_plain_spec.rb:375; CREATE EXTENSION istore; SELECT istore_to_array('5=>50, 7=>70, 9=>90'::bigistore); istore_to_array ------------------ {5,50,7,70,9,90} (1 row) SELECT istore_to_array('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); istore_to_array ------------------------------------------------------------------------------------ {-2147483647,10,-10,-9223372036854775807,0,5,10,9223372036854775806,2147483647,10} (1 row) SELECT istore_to_array(''::bigistore); istore_to_array ----------------- {} (1 row) ROLLBACK; BEGIN; -- bigistore functions should convert istore to matrix; -- ./spec/istore/functions_plain_spec.rb:384; CREATE EXTENSION istore; SELECT istore_to_matrix('5=>50, 7=>70, 9=>90'::bigistore); istore_to_matrix ------------------------ {{5,50},{7,70},{9,90}} (1 row) SELECT istore_to_matrix('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); istore_to_matrix ---------------------------------------------------------------------------------------------- {{-2147483647,10},{-10,-9223372036854775807},{0,5},{10,9223372036854775806},{2147483647,10}} (1 row) ROLLBACK; BEGIN; -- bigistore functions should be able to find the smallest key; -- ./spec/istore/functions_plain_spec.rb:467; CREATE EXTENSION istore; SELECT min_key(''::bigistore); min_key --------- (1 row) SELECT min_key('1=>1'::bigistore); min_key --------- 1 (1 row) SELECT min_key('1=>1, 2=>1'::bigistore); min_key --------- 1 (1 row) SELECT min_key('0=>2, 1=>2, 3=>0 ,2=>2'::bigistore); min_key --------- 0 (1 row) ROLLBACK; BEGIN; -- bigistore functions should be able to find the biggest key; -- ./spec/istore/functions_plain_spec.rb:474; CREATE EXTENSION istore; SELECT max_key(''::bigistore); max_key --------- (1 row) SELECT max_key('1=>1'::bigistore); max_key --------- 1 (1 row) SELECT max_key('1=>1, 2=>1'::bigistore); max_key --------- 2 (1 row) SELECT max_key('0=>2, 1=>2, 3=>0 ,2=>2'::bigistore); max_key --------- 3 (1 row) ROLLBACK; BEGIN; -- bigistore functions slice should return a partial istore; -- ./spec/istore/functions_plain_spec.rb:392; CREATE EXTENSION istore; SELECT slice('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore, ARRAY[3,5,1,9,11]); slice -------------------------------------------- "1"=>"10", "3"=>"30", "5"=>"50", "9"=>"90" (1 row) SELECT slice('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, ARRAY[10,0]); slice --------------------------------------- "0"=>"5", "10"=>"9223372036854775806" (1 row) ROLLBACK; BEGIN; -- bigistore functions slice should return null if no key match; -- ./spec/istore/functions_plain_spec.rb:399; CREATE EXTENSION istore; SELECT slice('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore, ARRAY[30,50,10,90]); slice ------- (1 row) ROLLBACK; BEGIN; -- bigistore functions slice_array should return a values from istore; -- ./spec/istore/functions_plain_spec.rb:405; CREATE EXTENSION istore; SELECT slice_array('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore, ARRAY[3,5,1,9,11]); slice_array -------------------- {30,50,10,90,NULL} (1 row) SELECT slice_array('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, ARRAY[10,0]); slice_array ------------------------- {9223372036854775806,5} (1 row) ROLLBACK; BEGIN; -- bigistore functions slice_array should return null array if no key match; -- ./spec/istore/functions_plain_spec.rb:412; CREATE EXTENSION istore; SELECT slice_array('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore, ARRAY[30,50,10,90]); slice_array ----------------------- {NULL,NULL,NULL,NULL} (1 row) ROLLBACK; BEGIN; -- bigistore functions delete should delete a key from istore; -- ./spec/istore/functions_plain_spec.rb:419; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore,3); delete ------------------------------------------------------------------ "1"=>"10", "2"=>"20", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) SELECT delete('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, 10); delete ---------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-9223372036854775807", "0"=>"5", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- bigistore functions delete should return istore if key unmatched; -- ./spec/istore/functions_plain_spec.rb:426; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore,6); delete ----------------------------------------------------------------------------- "1"=>"10", "2"=>"20", "3"=>"30", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) ROLLBACK; BEGIN; -- bigistore functions delete should delete multiple keys from istore; -- ./spec/istore/functions_plain_spec.rb:431; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore,ARRAY[7,8,2,5,4]); delete --------------------------------- "1"=>"10", "3"=>"30", "9"=>"90" (1 row) SELECT delete('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, ARRAY[0,10,-10]); delete ----------------------------------------- "-2147483647"=>"10", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- bigistore functions delete should return istore if keys are unmatched; -- ./spec/istore/functions_plain_spec.rb:438; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::bigistore,ARRAY[8,6]); delete ----------------------------------------------------------------------------- "1"=>"10", "2"=>"20", "3"=>"30", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) ROLLBACK; BEGIN; -- bigistore functions delete should delete istore from istore; -- ./spec/istore/functions_plain_spec.rb:443; CREATE EXTENSION istore; SELECT delete('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, '0=>5, 10=>100'); delete ----------------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-9223372036854775807", "10"=>"9223372036854775806", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- bigistore functions existence should check presence of a key; -- ./spec/istore/functions_plain_spec.rb:450; CREATE EXTENSION istore; SELECT exist('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, 10); exist ------- t (1 row) SELECT exist('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, 25); exist ------- f (1 row) ROLLBACK; BEGIN; -- bigistore functions existence should check presence of any key; -- ./spec/istore/functions_plain_spec.rb:454; CREATE EXTENSION istore; SELECT exists_any('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, Array[10,0]); exists_any ------------ t (1 row) SELECT exists_any('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, Array[27,25]); exists_any ------------ f (1 row) SELECT exists_any('1=>4,2=>5'::bigistore, ARRAY[]::int[]);; exists_any ------------ f (1 row) ROLLBACK; BEGIN; -- bigistore functions existence should check presence of all key; -- ./spec/istore/functions_plain_spec.rb:459; CREATE EXTENSION istore; SELECT exists_all('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, Array[10,0]); exists_all ------------ t (1 row) SELECT exists_all('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, Array[10,25]); exists_all ------------ f (1 row) SELECT exists_all('1=>4,2=>5'::bigistore, ARRAY[1,3]);; exists_all ------------ f (1 row) SELECT exists_all('1=>4,2=>5'::bigistore, ARRAY[]::int[]);; exists_all ------------ t (1 row) ROLLBACK; BEGIN; -- bigistore functions concat should concat two istores; -- ./spec/istore/functions_plain_spec.rb:482; CREATE EXTENSION istore; SELECT concat('1=>4, 2=>5'::bigistore, '3=>4, 2=>7'::bigistore); concat ------------------------------ "1"=>"4", "2"=>"7", "3"=>"4" (1 row) SELECT concat('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, '-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); concat --------------------------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-9223372036854775807", "0"=>"5", "10"=>"9223372036854775806", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- bigistore functions concat should concat empty istores; -- ./spec/istore/functions_plain_spec.rb:489; CREATE EXTENSION istore; SELECT concat('-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore, ''::bigistore); concat --------------------------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-9223372036854775807", "0"=>"5", "10"=>"9223372036854775806", "2147483647"=>"10" (1 row) SELECT concat(''::bigistore, '-2147483647 => 10, -10 => -9223372036854775807, 0 => 5, 10 => 9223372036854775806, 2147483647 => 10'::bigistore); concat --------------------------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-9223372036854775807", "0"=>"5", "10"=>"9223372036854775806", "2147483647"=>"10" (1 row) SELECT concat(''::bigistore, ''::bigistore); concat -------- (1 row) ROLLBACK; BEGIN; -- istore functions should find keys with exists; -- ./spec/istore/functions_plain_spec.rb:10; CREATE EXTENSION istore; SELECT exist('1=>1'::istore, 1); exist ------- t (1 row) SELECT exist('1=>1'::istore, 2); exist ------- f (1 row) SELECT exist('1=>1, -1=>0'::istore, 2); exist ------- f (1 row) SELECT exist('1=>1, -1=>0'::istore, -1); exist ------- t (1 row) ROLLBACK; BEGIN; -- istore functions should fetchvals; -- ./spec/istore/functions_plain_spec.rb:17; CREATE EXTENSION istore; SELECT fetchval('1=>1'::istore, 1); fetchval ---------- 1 (1 row) SELECT fetchval('2=>1'::istore, 1); fetchval ---------- (1 row) SELECT fetchval('1=>1, 1=>1'::istore, 1); fetchval ---------- 2 (1 row) SELECT fetchval('1=>1, 1=>1'::istore, 2); fetchval ---------- (1 row) ROLLBACK; BEGIN; -- istore functions should return set of ints; -- ./spec/istore/functions_plain_spec.rb:24; CREATE EXTENSION istore; SELECT * FROM each('1=>1'::istore); key | value -----+------- 1 | 1 (1 row) SELECT * FROM each('5=>11, 4=>8'::istore); key | value -----+------- 4 | 8 5 | 11 (2 rows) SELECT * FROM each('5=>-411, 4=>8'::istore); key | value -----+------- 4 | 8 5 | -411 (2 rows) SELECT value + 100 FROM each('5=>-411, 4=>8'::istore); ?column? ---------- 108 -311 (2 rows) SELECT * FROM each('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); key | value -------------+------------- -2147483647 | 10 -10 | -2147483647 0 | 5 10 | 2147483647 2147483647 | 10 (5 rows) SELECT * FROM each(NULL::istore); key | value -----+------- (0 rows) ROLLBACK; BEGIN; -- istore functions should compact istores; -- ./spec/istore/functions_plain_spec.rb:49; CREATE EXTENSION istore; SELECT compact('0=>2, 1=>2, 3=>0 ,2=>2'::istore); compact ------------------------------ "0"=>"2", "1"=>"2", "2"=>"2" (1 row) ROLLBACK; BEGIN; -- istore functions should add istores; -- ./spec/istore/functions_plain_spec.rb:54; CREATE EXTENSION istore; SELECT add('1=>1, 2=>1'::istore, '1=>1, 2=>1'::istore); add -------------------- "1"=>"2", "2"=>"2" (1 row) SELECT add('1=>1, 2=>1'::istore, '-1=>1, 2=>1'::istore); add ------------------------------- "-1"=>"1", "1"=>"1", "2"=>"2" (1 row) SELECT add('1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); add -------------------------------- "-1"=>"-1", "1"=>"1", "2"=>"2" (1 row) SELECT add('-1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); add --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); add ---------------------- "-1"=>"-2", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::istore, 1); add --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT add('-1=>-1, 2=>1'::istore, -1); add ---------------------- "-1"=>"-2", "2"=>"0" (1 row) SELECT add('-1=>-1, 2=>1'::istore, 0); add ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT add(istore(Array[]::integer[], Array[]::integer[]), '1=>0'::istore);; add ---------- "1"=>"0" (1 row) ROLLBACK; BEGIN; -- istore functions should substract istores; -- ./spec/istore/functions_plain_spec.rb:75; CREATE EXTENSION istore; SELECT subtract('1=>1, 2=>1'::istore, '1=>1, 2=>1'::istore); subtract -------------------- "1"=>"0", "2"=>"0" (1 row) SELECT subtract('1=>1, 2=>1'::istore, '-1=>1, 2=>1'::istore); subtract -------------------------------- "-1"=>"-1", "1"=>"1", "2"=>"0" (1 row) SELECT subtract('1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); subtract ------------------------------- "-1"=>"1", "1"=>"1", "2"=>"0" (1 row) SELECT subtract('-1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); subtract --------------------- "-1"=>"2", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); subtract --------------------- "-1"=>"0", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::istore, 1); subtract ---------------------- "-1"=>"-2", "2"=>"0" (1 row) SELECT subtract('-1=>-1, 2=>1'::istore, -1); subtract --------------------- "-1"=>"0", "2"=>"2" (1 row) SELECT subtract('-1=>-1, 2=>1'::istore, 0); subtract ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT subtract(istore(Array[]::integer[], Array[]::integer[]), '1=>0'::istore);; subtract ---------- "1"=>"0" (1 row) ROLLBACK; BEGIN; -- istore functions should multiply istores; -- ./spec/istore/functions_plain_spec.rb:96; CREATE EXTENSION istore; SELECT multiply('1=>1, 2=>1'::istore, '1=>1, 2=>1'::istore); multiply -------------------- "1"=>"1", "2"=>"1" (1 row) SELECT multiply('1=>1, 2=>1'::istore, '-1=>1, 2=>1'::istore); multiply ---------- "2"=>"1" (1 row) SELECT multiply('1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); multiply ---------- "2"=>"1" (1 row) SELECT multiply('-1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); multiply ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); multiply --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::istore, 1); multiply ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT multiply('-1=>-1, 2=>1'::istore, -1); multiply ---------------------- "-1"=>"1", "2"=>"-1" (1 row) SELECT multiply('-1=>-1, 2=>1'::istore, 0); multiply --------------------- "-1"=>"0", "2"=>"0" (1 row) ROLLBACK; BEGIN; -- istore functions should divide istores; -- ./spec/istore/functions_plain_spec.rb:115; CREATE EXTENSION istore; SELECT divide('1=>1, 2=>1'::istore, '1=>1, 2=>1'::istore); divide -------------------- "1"=>"1", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::istore, '-1=>1, 2=>1'::istore); divide ---------- "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); divide ---------- "2"=>"1" (1 row) SELECT divide('-1=>1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); divide ---------------------- "-1"=>"-1", "2"=>"1" (1 row) SELECT divide('-1=>-1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); divide --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT divide('-1=>-1, 2=>1'::istore, '-1=>-1, 2=>1'::istore); divide --------------------- "-1"=>"1", "2"=>"1" (1 row) SELECT divide('1=>0, 2=>1'::istore, '1=>-1, 2=>1'::istore); divide -------------------- "1"=>"0", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::istore, '1=>-1, 2=>1, 3=>0'::istore); divide --------------------- "1"=>"-1", "2"=>"1" (1 row) SELECT divide('1=>1, 2=>1'::istore, '3=>0'::istore); divide -------- (1 row) SELECT divide('-1=>-1, 2=>1'::istore, -1); divide ---------------------- "-1"=>"1", "2"=>"-1" (1 row) ROLLBACK; BEGIN; -- istore functions should raise division by zero error; -- ./spec/istore/functions_plain_spec.rb:137; CREATE EXTENSION istore; SELECT divide('-1=>-1, 2=>1'::istore, 0); ERROR: division by zero ROLLBACK; BEGIN; -- istore functions should raise division by zero error; -- ./spec/istore/functions_plain_spec.rb:141; CREATE EXTENSION istore; SELECT divide('-1=>-1, 2=>1'::istore, '2=>0'); ERROR: division by zero ROLLBACK; BEGIN; -- istore functions should generate #{type} from array; -- ./spec/istore/functions_plain_spec.rb:145; CREATE EXTENSION istore; SELECT istore(ARRAY[1]); istore ---------- "1"=>"1" (1 row) SELECT istore(ARRAY[1,1,1,1]); istore ---------- "1"=>"4" (1 row) SELECT istore(NULL); istore -------- (1 row) SELECT istore(ARRAY[1,2,3,4]); istore ---------------------------------------- "1"=>"1", "2"=>"1", "3"=>"1", "4"=>"1" (1 row) SELECT istore(ARRAY[1,2,3,4,1,2,3,4]); istore ---------------------------------------- "1"=>"2", "2"=>"2", "3"=>"2", "4"=>"2" (1 row) SELECT istore(ARRAY[1,2,3,4,1,2,3,NULL]); istore ---------------------------------------- "1"=>"2", "2"=>"2", "3"=>"2", "4"=>"1" (1 row) SELECT istore(ARRAY[NULL,2,3,4,1,2,3,4]); istore ---------------------------------------- "1"=>"1", "2"=>"2", "3"=>"2", "4"=>"2" (1 row) SELECT istore(ARRAY[NULL,2,3,4,1,2,3,NULL]); istore ---------------------------------------- "1"=>"1", "2"=>"2", "3"=>"2", "4"=>"1" (1 row) SELECT istore(ARRAY[1,2,3,NULL,1,NULL,3,4,1,2,3]); istore ---------------------------------------- "1"=>"3", "2"=>"2", "3"=>"3", "4"=>"1" (1 row) SELECT istore(ARRAY[NULL,NULL,NULL,NULL]::integer[]); istore -------- (1 row) SELECT istore(ARRAY[]::integer[]); istore -------- (1 row) ROLLBACK; BEGIN; -- istore functions should sum up istores; -- ./spec/istore/functions_plain_spec.rb:167; CREATE EXTENSION istore; SELECT sum_up('1=>1'::istore); sum_up -------- 1 (1 row) SELECT sum_up(NULL::istore); sum_up -------- (1 row) SELECT sum_up('1=>1, 2=>1'::istore); sum_up -------- 2 (1 row) SELECT sum_up('1=>1, 5=>1, 3=> 4'::istore, 3); sum_up -------- 5 (1 row) SELECT sum_up('1=>1 ,2=>-1, 1=>1'::istore); sum_up -------- 1 (1 row) ROLLBACK; BEGIN; -- istore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:175; CREATE EXTENSION istore; CREATE TABLE test (a istore); INSERT INTO test VALUES('1=>1'),('2=>1'), ('3=>1'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"1" (1 row) ROLLBACK; BEGIN; -- istore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:182; CREATE EXTENSION istore; CREATE TABLE test (a istore); INSERT INTO test VALUES('1=>1'),('2=>1'),('3=>1'),(NULL),('3=>3'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"4" (1 row) ROLLBACK; BEGIN; -- istore functions should sum istores from table; -- ./spec/istore/functions_plain_spec.rb:189; CREATE EXTENSION istore; CREATE TABLE test (a istore); INSERT INTO test VALUES('1=>1'),('2=>1'),('3=>1'),(NULL),('3=>0'); SELECT SUM(a) FROM test; sum ------------------------------ "1"=>"1", "2"=>"1", "3"=>"1" (1 row) ROLLBACK; BEGIN; -- istore functions should return istores from arrays; -- ./spec/istore/functions_plain_spec.rb:196; CREATE EXTENSION istore; SELECT istore(Array[5,3,4,5], Array[1,2,3,4]); istore ------------------------------ "3"=>"2", "4"=>"3", "5"=>"5" (1 row) SELECT istore(Array[5,3,4,5], Array[1,2,3,4]); istore ------------------------------ "3"=>"2", "4"=>"3", "5"=>"5" (1 row) SELECT istore(Array[5,3,4,5], Array[4000,2,4000,4]); istore ------------------------------------ "3"=>"2", "4"=>"4000", "5"=>"4004" (1 row) ROLLBACK; BEGIN; -- istore functions should fill gaps; -- ./spec/istore/functions_plain_spec.rb:211; CREATE EXTENSION istore; SELECT fill_gaps('2=>17, 4=>3'::istore, 5, 0); fill_gaps ------------------------------------------------------------- "0"=>"0", "1"=>"0", "2"=>"17", "3"=>"0", "4"=>"3", "5"=>"0" (1 row) SELECT fill_gaps('2=>17, 4=>3'::istore, 5); fill_gaps ------------------------------------------------------------- "0"=>"0", "1"=>"0", "2"=>"17", "3"=>"0", "4"=>"3", "5"=>"0" (1 row) SELECT fill_gaps('2=>17, 4=>3'::istore, 3, 11); fill_gaps -------------------------------------------- "0"=>"11", "1"=>"11", "2"=>"17", "3"=>"11" (1 row) SELECT fill_gaps('2=>17, 4=>3'::istore, 0, 0); fill_gaps ----------- "0"=>"0" (1 row) SELECT fill_gaps('2=>17'::istore, 3, NULL); fill_gaps ----------- (1 row) SELECT fill_gaps('2=>0, 3=>3'::istore, 3, 0); fill_gaps ---------------------------------------- "0"=>"0", "1"=>"0", "2"=>"0", "3"=>"3" (1 row) SELECT fill_gaps(''::istore, 3, 0); fill_gaps ---------------------------------------- "0"=>"0", "1"=>"0", "2"=>"0", "3"=>"0" (1 row) SELECT fill_gaps(''::istore, 3, 400); fill_gaps ------------------------------------------------ "0"=>"400", "1"=>"400", "2"=>"400", "3"=>"400" (1 row) SELECT fill_gaps(NULL::istore, 3, 0); fill_gaps ----------- (1 row) SELECT fill_gaps('2=>17, 4=>3'::istore, -5, 0); ERROR: parameter upto must be >= 0 ROLLBACK; BEGIN; -- istore functions should fill accumulate; -- ./spec/istore/functions_plain_spec.rb:240; CREATE EXTENSION istore; SELECT accumulate('2=>17, 4=>3'::istore); accumulate --------------------------------- "2"=>"17", "3"=>"17", "4"=>"20" (1 row) SELECT accumulate('2=>0, 4=>3'::istore); accumulate ------------------------------ "2"=>"0", "3"=>"0", "4"=>"3" (1 row) SELECT accumulate('1=>3, 2=>0, 4=>3, 6=>2'::istore); accumulate ------------------------------------------------------------ "1"=>"3", "2"=>"3", "3"=>"3", "4"=>"6", "5"=>"6", "6"=>"8" (1 row) SELECT accumulate(''::istore); accumulate ------------ (1 row) SELECT accumulate('10=>5'::istore); accumulate ------------ "10"=>"5" (1 row) SELECT accumulate(NULL::istore); accumulate ------------ (1 row) SELECT accumulate('-20=> 5, -10=> 5'::istore); accumulate ------------------------------------------------------------------------------------------------------------------------------------- "-20"=>"5", "-19"=>"5", "-18"=>"5", "-17"=>"5", "-16"=>"5", "-15"=>"5", "-14"=>"5", "-13"=>"5", "-12"=>"5", "-11"=>"5", "-10"=>"10" (1 row) SELECT accumulate('-5=> 5, 3=> 5'::istore); accumulate ------------------------------------------------------------------------------------------------ "-5"=>"5", "-4"=>"5", "-3"=>"5", "-2"=>"5", "-1"=>"5", "0"=>"5", "1"=>"5", "2"=>"5", "3"=>"10" (1 row) ROLLBACK; BEGIN; -- istore functions should fill accumulate upto; -- ./spec/istore/functions_plain_spec.rb:256; CREATE EXTENSION istore; SELECT accumulate('2=>17, 4=>3'::istore, 8); accumulate ----------------------------------------------------------------------------- "2"=>"17", "3"=>"17", "4"=>"20", "5"=>"20", "6"=>"20", "7"=>"20", "8"=>"20" (1 row) SELECT accumulate('2=>0, 4=>3'::istore, 8); accumulate ---------------------------------------------------------------------- "2"=>"0", "3"=>"0", "4"=>"3", "5"=>"3", "6"=>"3", "7"=>"3", "8"=>"3" (1 row) SELECT accumulate('1=>3, 2=>0, 4=>3, 6=>2'::istore, 8); accumulate -------------------------------------------------------------------------------- "1"=>"3", "2"=>"3", "3"=>"3", "4"=>"6", "5"=>"6", "6"=>"8", "7"=>"8", "8"=>"8" (1 row) SELECT accumulate(''::istore, 8); accumulate ------------ (1 row) SELECT accumulate('10=>5'::istore, 8); accumulate ------------ (1 row) SELECT accumulate('1=>5'::istore, 0); accumulate ------------ (1 row) SELECT accumulate(NULL::istore, 8); accumulate ------------ (1 row) SELECT accumulate('-20=> 5, -10=> 5'::istore, -8); accumulate ------------------------------------------------------------------------------------------------------------------------------------------------------------- "-20"=>"5", "-19"=>"5", "-18"=>"5", "-17"=>"5", "-16"=>"5", "-15"=>"5", "-14"=>"5", "-13"=>"5", "-12"=>"5", "-11"=>"5", "-10"=>"10", "-9"=>"10", "-8"=>"10" (1 row) SELECT accumulate('-5=> 5, 3=> 5'::istore, 2); accumulate ------------------------------------------------------------------------------------- "-5"=>"5", "-4"=>"5", "-3"=>"5", "-2"=>"5", "-1"=>"5", "0"=>"5", "1"=>"5", "2"=>"5" (1 row) ROLLBACK; BEGIN; -- istore functions should accumulate big numbers; -- ./spec/istore/functions_plain_spec.rb:273; CREATE EXTENSION istore; SELECT accumulate('0=>20000000000, 1=>10000000000, 3=>10000000000'::bigistore, 4); accumulate ---------------------------------------------------------------------------------------------------- "0"=>"20000000000", "1"=>"30000000000", "2"=>"30000000000", "3"=>"40000000000", "4"=>"40000000000" (1 row) ROLLBACK; BEGIN; -- istore functions should seed an #{type} from integer; -- ./spec/istore/functions_plain_spec.rb:278; CREATE EXTENSION istore; SELECT istore_seed(2,5,8::int); istore_seed ---------------------------------------- "2"=>"8", "3"=>"8", "4"=>"8", "5"=>"8" (1 row) SELECT istore_seed(2,5,NULL::int); istore_seed ------------- (1 row) SELECT istore_seed(2,5,0::int); istore_seed ---------------------------------------- "2"=>"0", "3"=>"0", "4"=>"0", "5"=>"0" (1 row) SELECT istore_seed(2,2,8::int); istore_seed ------------- "2"=>"8" (1 row) SELECT istore_seed(2,0,8::int); ERROR: parameter upto must be >= from ROLLBACK; BEGIN; -- istore functions should throw an error if negativ seed span; -- ./spec/istore/functions_plain_spec.rb:289; CREATE EXTENSION istore; SELECT istore_seed(-2,0,8); ERROR: parameter from must be >= 0 ROLLBACK; BEGIN; -- istore functions should merge istores by larger keys; -- ./spec/istore/functions_plain_spec.rb:293; CREATE EXTENSION istore; SELECT istore_val_larger('1=>1,2=>1,3=>3'::istore, '1=>2,3=>1,4=>1'); istore_val_larger ---------------------------------------- "1"=>"2", "2"=>"1", "3"=>"3", "4"=>"1" (1 row) ROLLBACK; BEGIN; -- istore functions should merge istores by smaller keys; -- ./spec/istore/functions_plain_spec.rb:298; CREATE EXTENSION istore; SELECT istore_val_smaller('1=>1,2=>1,3=>3'::istore, '1=>2,3=>1,4=>1'); istore_val_smaller ---------------------------------------- "1"=>"1", "2"=>"1", "3"=>"1", "4"=>"1" (1 row) ROLLBACK; BEGIN; -- istore functions should return #{type} with maxed values; -- ./spec/istore/functions_plain_spec.rb:303; CREATE EXTENSION istore; SELECT MAX(s) FROM (VALUES('1=>5, 2=>2, 3=>3'::istore),('1=>1, 2=>5, 3=>3'),('1=>1, 2=>4, 3=>5'))t(s); max ------------------------------ "1"=>"5", "2"=>"5", "3"=>"5" (1 row) ROLLBACK; BEGIN; -- istore functions should return #{type} with maxed values; -- ./spec/istore/functions_plain_spec.rb:308; CREATE EXTENSION istore; SELECT MIN(s) FROM (VALUES('1=>5, 2=>2, 3=>3'::istore),('1=>1, 2=>5, 3=>3'),('1=>1, 2=>4, 3=>5'))t(s); min ------------------------------ "1"=>"1", "2"=>"2", "3"=>"3" (1 row) ROLLBACK; BEGIN; -- istore functions should return keys as array; -- ./spec/istore/functions_plain_spec.rb:313; CREATE EXTENSION istore; SELECT akeys('-5=>10, 0=>-5, 5=>0'::istore); akeys ---------- {-5,0,5} (1 row) SELECT akeys(''::istore); akeys ------- {} (1 row) ROLLBACK; BEGIN; -- istore functions should return values as array; -- ./spec/istore/functions_plain_spec.rb:318; CREATE EXTENSION istore; SELECT avals('-5=>10, 0=>-5, 5=>0'::istore); avals ----------- {10,-5,0} (1 row) SELECT avals(''::istore); avals ------- {} (1 row) ROLLBACK; BEGIN; -- istore functions should return keys as set; -- ./spec/istore/functions_plain_spec.rb:322; CREATE EXTENSION istore; SELECT skeys('-5=>10, 0=>-5, 5=>0'::istore); skeys ------- -5 0 5 (3 rows) SELECT skeys(''::istore); skeys ------- (0 rows) ROLLBACK; BEGIN; -- istore functions should return values set array; -- ./spec/istore/functions_plain_spec.rb:330; CREATE EXTENSION istore; SELECT svals('-5=>10, 0=>-5, 5=>0'::istore); svals ------- 10 -5 0 (3 rows) SELECT svals(''::istore); svals ------- (0 rows) ROLLBACK; BEGIN; -- istore functions should sum up istores; -- ./spec/istore/functions_plain_spec.rb:338; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>10'::istore); sum_up -------- 15 (1 row) ROLLBACK; BEGIN; -- istore functions should sum up istores with big numbers; -- ./spec/istore/functions_plain_spec.rb:342; CREATE EXTENSION istore; SELECT sum_up('10=>2000000000, 15=>1000000000'::istore); sum_up ------------ 3000000000 (1 row) ROLLBACK; BEGIN; -- istore functions should sum up bigistores; -- ./spec/istore/functions_plain_spec.rb:346; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>10'::bigistore); sum_up -------- 15 (1 row) ROLLBACK; BEGIN; -- istore functions should sum up istores with negative values; -- ./spec/istore/functions_plain_spec.rb:350; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>-10'::istore); sum_up -------- -5 (1 row) ROLLBACK; BEGIN; -- istore functions should sum up bigistores with negative values; -- ./spec/istore/functions_plain_spec.rb:354; CREATE EXTENSION istore; SELECT sum_up('10=>5, 15=>-10'::bigistore); sum_up -------- -5 (1 row) ROLLBACK; BEGIN; -- istore functions should return length of empty istores; -- ./spec/istore/functions_plain_spec.rb:358; CREATE EXTENSION istore; SELECT istore_length(istore(ARRAY[]::integer[],ARRAY[]::integer[])); istore_length --------------- 0 (1 row) ROLLBACK; BEGIN; -- istore functions should return length of non-empty istores; -- ./spec/istore/functions_plain_spec.rb:362; CREATE EXTENSION istore; SELECT istore_length(istore(ARRAY[1],ARRAY[1])); istore_length --------------- 1 (1 row) SELECT istore_length(istore(ARRAY[1,2,3],ARRAY[1,2,3])); istore_length --------------- 3 (1 row) SELECT istore_length('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); istore_length --------------- 5 (1 row) ROLLBACK; BEGIN; -- istore functions should convert istore to json; -- ./spec/istore/functions_plain_spec.rb:368; CREATE EXTENSION istore; SELECT istore_to_json('5=>50, 7=>70, 9=>90'::istore); istore_to_json ----------------------------- {"5": 50, "7": 70, "9": 90} (1 row) SELECT istore_to_json('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); istore_to_json ------------------------------------------------------------------------------------- {"-2147483647": 10, "-10": -2147483647, "0": 5, "10": 2147483647, "2147483647": 10} (1 row) ROLLBACK; BEGIN; -- istore functions should convert istore to array; -- ./spec/istore/functions_plain_spec.rb:375; CREATE EXTENSION istore; SELECT istore_to_array('5=>50, 7=>70, 9=>90'::istore); istore_to_array ------------------ {5,50,7,70,9,90} (1 row) SELECT istore_to_array('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); istore_to_array ------------------------------------------------------------------ {-2147483647,10,-10,-2147483647,0,5,10,2147483647,2147483647,10} (1 row) SELECT istore_to_array(''::istore); istore_to_array ----------------- {} (1 row) ROLLBACK; BEGIN; -- istore functions should convert istore to matrix; -- ./spec/istore/functions_plain_spec.rb:384; CREATE EXTENSION istore; SELECT istore_to_matrix('5=>50, 7=>70, 9=>90'::istore); istore_to_matrix ------------------------ {{5,50},{7,70},{9,90}} (1 row) SELECT istore_to_matrix('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); istore_to_matrix ---------------------------------------------------------------------------- {{-2147483647,10},{-10,-2147483647},{0,5},{10,2147483647},{2147483647,10}} (1 row) ROLLBACK; BEGIN; -- istore functions should be able to find the smallest key; -- ./spec/istore/functions_plain_spec.rb:467; CREATE EXTENSION istore; SELECT min_key(''::istore); min_key --------- (1 row) SELECT min_key('1=>1'::istore); min_key --------- 1 (1 row) SELECT min_key('1=>1, 2=>1'::istore); min_key --------- 1 (1 row) SELECT min_key('0=>2, 1=>2, 3=>0 ,2=>2'::istore); min_key --------- 0 (1 row) ROLLBACK; BEGIN; -- istore functions should be able to find the biggest key; -- ./spec/istore/functions_plain_spec.rb:474; CREATE EXTENSION istore; SELECT max_key(''::istore); max_key --------- (1 row) SELECT max_key('1=>1'::istore); max_key --------- 1 (1 row) SELECT max_key('1=>1, 2=>1'::istore); max_key --------- 2 (1 row) SELECT max_key('0=>2, 1=>2, 3=>0 ,2=>2'::istore); max_key --------- 3 (1 row) ROLLBACK; BEGIN; -- istore functions slice should return a partial istore; -- ./spec/istore/functions_plain_spec.rb:392; CREATE EXTENSION istore; SELECT slice('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore, ARRAY[3,5,1,9,11]); slice -------------------------------------------- "1"=>"10", "3"=>"30", "5"=>"50", "9"=>"90" (1 row) SELECT slice('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, ARRAY[10,0]); slice ------------------------------ "0"=>"5", "10"=>"2147483647" (1 row) ROLLBACK; BEGIN; -- istore functions slice should return null if no key match; -- ./spec/istore/functions_plain_spec.rb:399; CREATE EXTENSION istore; SELECT slice('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore, ARRAY[30,50,10,90]); slice ------- (1 row) ROLLBACK; BEGIN; -- istore functions slice_array should return a values from istore; -- ./spec/istore/functions_plain_spec.rb:405; CREATE EXTENSION istore; SELECT slice_array('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore, ARRAY[3,5,1,9,11]); slice_array -------------------- {30,50,10,90,NULL} (1 row) SELECT slice_array('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, ARRAY[10,0]); slice_array ---------------- {2147483647,5} (1 row) ROLLBACK; BEGIN; -- istore functions slice_array should return null array if no key match; -- ./spec/istore/functions_plain_spec.rb:412; CREATE EXTENSION istore; SELECT slice_array('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore, ARRAY[30,50,10,90]); slice_array ----------------------- {NULL,NULL,NULL,NULL} (1 row) ROLLBACK; BEGIN; -- istore functions delete should delete a key from istore; -- ./spec/istore/functions_plain_spec.rb:419; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore,3); delete ------------------------------------------------------------------ "1"=>"10", "2"=>"20", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) SELECT delete('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, 10); delete ------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-2147483647", "0"=>"5", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- istore functions delete should return istore if key unmatched; -- ./spec/istore/functions_plain_spec.rb:426; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore,6); delete ----------------------------------------------------------------------------- "1"=>"10", "2"=>"20", "3"=>"30", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) ROLLBACK; BEGIN; -- istore functions delete should delete multiple keys from istore; -- ./spec/istore/functions_plain_spec.rb:431; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore,ARRAY[7,8,2,5,4]); delete --------------------------------- "1"=>"10", "3"=>"30", "9"=>"90" (1 row) SELECT delete('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, ARRAY[0,10,-10]); delete ----------------------------------------- "-2147483647"=>"10", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- istore functions delete should return istore if keys are unmatched; -- ./spec/istore/functions_plain_spec.rb:438; CREATE EXTENSION istore; SELECT delete('1=>10, 2=>20, 3=>30, 4=>40, 5=>50, 7=>70, 9=>90'::istore,ARRAY[8,6]); delete ----------------------------------------------------------------------------- "1"=>"10", "2"=>"20", "3"=>"30", "4"=>"40", "5"=>"50", "7"=>"70", "9"=>"90" (1 row) ROLLBACK; BEGIN; -- istore functions delete should delete istore from istore; -- ./spec/istore/functions_plain_spec.rb:443; CREATE EXTENSION istore; SELECT delete('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, '0=>5, 10=>100'); delete ----------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-2147483647", "10"=>"2147483647", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- istore functions existence should check presence of a key; -- ./spec/istore/functions_plain_spec.rb:450; CREATE EXTENSION istore; SELECT exist('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, 10); exist ------- t (1 row) SELECT exist('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, 25); exist ------- f (1 row) ROLLBACK; BEGIN; -- istore functions existence should check presence of any key; -- ./spec/istore/functions_plain_spec.rb:454; CREATE EXTENSION istore; SELECT exists_any('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, Array[10,0]); exists_any ------------ t (1 row) SELECT exists_any('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, Array[27,25]); exists_any ------------ f (1 row) SELECT exists_any('1=>4,2=>5'::istore, ARRAY[]::int[]);; exists_any ------------ f (1 row) ROLLBACK; BEGIN; -- istore functions existence should check presence of all key; -- ./spec/istore/functions_plain_spec.rb:459; CREATE EXTENSION istore; SELECT exists_all('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, Array[10,0]); exists_all ------------ t (1 row) SELECT exists_all('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, Array[10,25]); exists_all ------------ f (1 row) SELECT exists_all('1=>4,2=>5'::istore, ARRAY[1,3]);; exists_all ------------ f (1 row) SELECT exists_all('1=>4,2=>5'::istore, ARRAY[]::int[]);; exists_all ------------ t (1 row) ROLLBACK; BEGIN; -- istore functions concat should concat two istores; -- ./spec/istore/functions_plain_spec.rb:482; CREATE EXTENSION istore; SELECT concat('1=>4, 2=>5'::istore, '3=>4, 2=>7'::istore); concat ------------------------------ "1"=>"4", "2"=>"7", "3"=>"4" (1 row) SELECT concat('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, '-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); concat --------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-2147483647", "0"=>"5", "10"=>"2147483647", "2147483647"=>"10" (1 row) ROLLBACK; BEGIN; -- istore functions concat should concat empty istores; -- ./spec/istore/functions_plain_spec.rb:489; CREATE EXTENSION istore; SELECT concat('-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore, ''::istore); concat --------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-2147483647", "0"=>"5", "10"=>"2147483647", "2147483647"=>"10" (1 row) SELECT concat(''::istore, '-2147483647 => 10, -10 => -2147483647, 0 => 5, 10 => 2147483647, 2147483647 => 10'::istore); concat --------------------------------------------------------------------------------------------- "-2147483647"=>"10", "-10"=>"-2147483647", "0"=>"5", "10"=>"2147483647", "2147483647"=>"10" (1 row) SELECT concat(''::istore, ''::istore); concat -------- (1 row) ROLLBACK;