SELECT '[1,2,3]'::intvec; intvec --------- [1,2,3] (1 row) SELECT '[-1,-2,-3]'::intvec; intvec ------------ [-1,-2,-3] (1 row) SELECT ' [ 1, 2 , 3 ] '::intvec; intvec --------- [1,2,3] (1 row) SELECT '[1.23456]'::intvec; ERROR: invalid input syntax for type intvec: "[1.23456]" LINE 1: SELECT '[1.23456]'::intvec; ^ SELECT '[hello,1]'::intvec; ERROR: invalid input syntax for type intvec: "[hello,1]" LINE 1: SELECT '[hello,1]'::intvec; ^ SELECT '[127,-128]'::intvec; intvec ------------ [127,-128] (1 row) SELECT '[128,-129]'::intvec; ERROR: "128" is out of range for type intvec LINE 1: SELECT '[128,-129]'::intvec; ^ SELECT '[1,2,3'::intvec; ERROR: invalid input syntax for type intvec: "[1,2,3" LINE 1: SELECT '[1,2,3'::intvec; ^ SELECT '[1,2,3]9'::intvec; ERROR: invalid input syntax for type intvec: "[1,2,3]9" LINE 1: SELECT '[1,2,3]9'::intvec; ^ DETAIL: Junk after closing right brace. SELECT '1,2,3'::intvec; ERROR: invalid input syntax for type intvec: "1,2,3" LINE 1: SELECT '1,2,3'::intvec; ^ DETAIL: Vector contents must start with "[". SELECT ''::intvec; ERROR: invalid input syntax for type intvec: "" LINE 1: SELECT ''::intvec; ^ DETAIL: Vector contents must start with "[". SELECT '['::intvec; ERROR: invalid input syntax for type intvec: "[" LINE 1: SELECT '['::intvec; ^ SELECT '[,'::intvec; ERROR: invalid input syntax for type intvec: "[," LINE 1: SELECT '[,'::intvec; ^ SELECT '[]'::intvec; ERROR: intvec must have at least 1 dimension LINE 1: SELECT '[]'::intvec; ^ SELECT '[1,]'::intvec; ERROR: invalid input syntax for type intvec: "[1,]" LINE 1: SELECT '[1,]'::intvec; ^ SELECT '[1a]'::intvec; ERROR: invalid input syntax for type intvec: "[1a]" LINE 1: SELECT '[1a]'::intvec; ^ SELECT '[1,,3]'::intvec; ERROR: invalid input syntax for type intvec: "[1,,3]" LINE 1: SELECT '[1,,3]'::intvec; ^ SELECT '[1, ,3]'::intvec; ERROR: invalid input syntax for type intvec: "[1, ,3]" LINE 1: SELECT '[1, ,3]'::intvec; ^ SELECT '[1,2,3]'::intvec(3); intvec --------- [1,2,3] (1 row) SELECT '[1,2,3]'::intvec(2); ERROR: expected 2 dimensions, not 3 SELECT '[1,2,3]'::intvec(3, 2); ERROR: invalid type modifier LINE 1: SELECT '[1,2,3]'::intvec(3, 2); ^ SELECT '[1,2,3]'::intvec('a'); ERROR: invalid input syntax for type integer: "a" LINE 1: SELECT '[1,2,3]'::intvec('a'); ^ SELECT '[1,2,3]'::intvec(0); ERROR: dimensions for type intvec must be at least 1 LINE 1: SELECT '[1,2,3]'::intvec(0); ^ SELECT '[1,2,3]'::intvec(16001); ERROR: dimensions for type intvec cannot exceed 16000 LINE 1: SELECT '[1,2,3]'::intvec(16001); ^ SELECT unnest('{"[1,2,3]", "[4,5,6]"}'::intvec[]); unnest --------- [1,2,3] [4,5,6] (2 rows) SELECT '{"[1,2,3]"}'::intvec(2)[]; ERROR: expected 2 dimensions, not 3 SELECT '[1,2,3]'::intvec < '[1,2,3]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec < '[1,2]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec <= '[1,2,3]'; ?column? ---------- t (1 row) SELECT '[1,2,3]'::intvec <= '[1,2]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec = '[1,2,3]'; ?column? ---------- t (1 row) SELECT '[1,2,3]'::intvec = '[1,2]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec != '[1,2,3]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec != '[1,2]'; ?column? ---------- t (1 row) SELECT '[1,2,3]'::intvec >= '[1,2,3]'; ?column? ---------- t (1 row) SELECT '[1,2,3]'::intvec >= '[1,2]'; ?column? ---------- t (1 row) SELECT '[1,2,3]'::intvec > '[1,2,3]'; ?column? ---------- f (1 row) SELECT '[1,2,3]'::intvec > '[1,2]'; ?column? ---------- t (1 row) SELECT intvec_cmp('[1,2,3]', '[1,2,3]'); intvec_cmp ------------ 0 (1 row) SELECT intvec_cmp('[1,2,3]', '[0,0,0]'); intvec_cmp ------------ 1 (1 row) SELECT intvec_cmp('[0,0,0]', '[1,2,3]'); intvec_cmp ------------ -1 (1 row) SELECT intvec_cmp('[1,2]', '[1,2,3]'); intvec_cmp ------------ -1 (1 row) SELECT intvec_cmp('[1,2,3]', '[1,2]'); intvec_cmp ------------ 1 (1 row) SELECT intvec_cmp('[1,2]', '[2,3,4]'); intvec_cmp ------------ -1 (1 row) SELECT intvec_cmp('[2,3]', '[1,2,3]'); intvec_cmp ------------ 1 (1 row) SELECT vector_dims('[1,2,3]'::intvec); vector_dims ------------- 3 (1 row) SELECT l2_distance('[0,0]'::intvec, '[3,4]'); l2_distance ------------- 5 (1 row) SELECT l2_distance('[0,0]'::intvec, '[0,1]'); l2_distance ------------- 1 (1 row) SELECT l2_distance('[1,2]'::intvec, '[3]'); ERROR: different intvec dimensions 2 and 1 SELECT '[0,0]'::intvec <-> '[3,4]'; ?column? ---------- 5 (1 row) SELECT inner_product('[1,2]'::intvec, '[3,4]'); inner_product --------------- 11 (1 row) SELECT inner_product('[1,2]'::intvec, '[3]'); ERROR: different intvec dimensions 2 and 1 SELECT inner_product('[127]'::intvec, '[127]'); inner_product --------------- 16129 (1 row) SELECT '[1,2]'::intvec <#> '[3,4]'; ?column? ---------- -11 (1 row) SELECT cosine_distance('[1,2]'::intvec, '[2,4]'); cosine_distance ----------------- 0 (1 row) SELECT cosine_distance('[1,2]'::intvec, '[0,0]'); cosine_distance ----------------- NaN (1 row) SELECT cosine_distance('[1,1]'::intvec, '[1,1]'); cosine_distance ----------------- 0 (1 row) SELECT cosine_distance('[1,0]'::intvec, '[0,2]'); cosine_distance ----------------- 1 (1 row) SELECT cosine_distance('[1,1]'::intvec, '[-1,-1]'); cosine_distance ----------------- 2 (1 row) SELECT cosine_distance('[1,2]'::intvec, '[3]'); ERROR: different intvec dimensions 2 and 1 SELECT '[1,2]'::intvec <=> '[2,4]'; ?column? ---------- 0 (1 row) SELECT l1_distance('[0,0]'::intvec, '[3,4]'); l1_distance ------------- 7 (1 row) SELECT l1_distance('[0,0]'::intvec, '[0,1]'); l1_distance ------------- 1 (1 row) SELECT l1_distance('[1,2]'::intvec, '[3]'); ERROR: different intvec dimensions 2 and 1