select Open+Close from Quote_get('IBM'); ?column? ------------------------------------ float4:{20.7,40.4,60.7,80.7,100.7} (1 row) select Open-Close from Quote_get('IBM'); ?column? --------------------------------------------- float4:{-0.3,0,0.299999,0.299999,-0.299999} (1 row) select Open*Close from Quote_get('IBM'); ?column? ------------------------------------------- float4:{107.1,408.04,921.1,1628.1,2535.1} (1 row) select Open/Close from Quote_get('IBM'); ?column? ---------------------------------------------- float4:{0.971429,1,1.00993,1.00746,0.994059} (1 row) select Open%Close from Quote_get('IBM'); ?column? ---------------------------------------- float4:{10.2,0,0.299999,0.299999,50.2} (1 row) select Open^Close from Quote_get('IBM'); ?column? -------------------------------------------------------------------------------------------------------------- float8:{38931552097.3912,2.33398999511658e+26,6.6966296391943e+44,4.16574958399165e+64,7.68312765681365e+85} (1 row) select Close+*Volume from Quote_get('IBM'); ?column? ------------------ 55480.0006866455 (1 row) select Volume//Close from Quote_get('IBM'); ?column? ------------------ 36.9866668294271 (1 row) select Open~Close from Quote_get('IBM'); ?column? ------------------ 0.99982502975582 (1 row) select (Open>Close)?Day from Quote_get('IBM'); ?column? ------------------------------ date:{11-04-2013,11-05-2013} (1 row) select (Open>Close)? from Quote_get('IBM'); ?column? ------------ int8:{2,3} (1 row) select -Open from Quote_get('IBM'); ?column? ---------------------------------------- float4:{-10.2,-20.2,-30.5,-40.5,-50.2} (1 row) select Open>Close from Quote_get('IBM'); ?column? ------------------ char:{0,0,1,1,0} (1 row) select Open>=Close from Quote_get('IBM'); ?column? ------------------ char:{0,1,1,1,0} (1 row) select OpenClose from Quote_get('IBM'); ?column? ------------------ char:{1,0,1,1,1} (1 row) select (Open>=Close) & (High<>Low) from Quote_get('IBM'); ?column? ------------------ char:{0,0,1,1,0} (1 row) select (Open>Close) | (High=Low) from Quote_get('IBM'); ?column? ------------------ char:{0,1,1,1,0} (1 row) select (Open=Close) # (High=Low) from Quote_get('IBM'); ?column? ------------------ char:{0,0,0,0,0} (1 row) select !(Open=Close) from Quote_get('IBM'); ?column? ------------------ char:{1,0,1,1,1} (1 row) select ~Volume from Quote_get('IBM'); ?column? --------------------------------- int4:{-101,-201,-301,-401,-501} (1 row) select Volume & 1 from Quote_get('IBM'); ?column? ------------------ int4:{0,0,0,0,0} (1 row) select Volume | 1 from Quote_get('IBM'); ?column? ---------------------------- int4:{101,201,301,401,501} (1 row) select Volume # -1 from Quote_get('IBM'); ?column? --------------------------------- int4:{-101,-201,-301,-401,-501} (1 row) select @(Open-Close) from Quote_get('IBM'); ?column? ------------------------------------------- float4:{0.3,0,0.299999,0.299999,0.299999} (1 row) select Day,Open||Close from Quote_get('IBM', date('01-Nov-2013'), date('03-Nov-2013')); day | ?column? ------------------------------+------------------- date:{11-01-2013,11-02-2013} | bpchar8:{33#A,AA} (1 row) select cs_maxof(Open,Close) from Quote_get('IBM'); cs_maxof ----------------------------------- float4:{10.5,20.2,30.5,40.5,50.5} (1 row) select cs_minof(Open,Close) from Quote_get('IBM'); cs_minof ----------------------------------- float4:{10.2,20.2,30.2,40.2,50.2} (1 row) select cs_norm(Close) from Quote_get('IBM'); cs_norm --------------------------------------------------------------------------------------------------- float8:{0.140354513651518,0.270015360270729,0.403686325653127,0.537357291035525,0.67503837518111} (1 row) select Close*'{2.0,2.1,2.2}'::text from Quote_get('IBM', '1-Nov-2013', '4-Nov-2013'); ?column? ------------------------- float4:{21,42.42,66.44} (1 row) select Close*'float4:{2.0,2.1,2.2}' from Quote_get('IBM', '1-Nov-2013', '4-Nov-2013'); ?column? ------------------------- float4:{21,42.42,66.44} (1 row) select Day=date('1-Nov-2013') from Quote_get('IBM'); ?column? ------------------ char:{1,0,0,0,0} (1 row) select Volume*2 from Quote_get('ABB'); ?column? ------------------ int4:{1200,1400} (1 row) select cs_parse('{1,2,3,4}','int4')+cs_const(3.14,'float4'); ?column? ------------------------------ float4:{4.14,5.14,6.14,7.14} (1 row) select cs_parse('{1,2,3,4}','int4')+10; ?column? -------------------- int4:{11,12,13,14} (1 row) select cs_parse('{1,2,3,4}', 'int4')+'{10,20,30,40}'::text; ?column? -------------------- int4:{11,22,33,44} (1 row) select cs_parse('{11-Nov-2013,12-Nov-2013,30-Nov-2013}', 'date'); cs_parse ----------------------------------------- date:{11-11-2013,11-12-2013,11-30-2013} (1 row) select cs_concat('int4:{1,2,3}','int4:{4,5,6}'); cs_concat -------------------- int4:{1,2,3,4,5,6} (1 row) select cs_parse('{1,2,3,4,5}', 'int4') << 1; ?column? ---------------- int4:{2,3,4,5} (1 row) select cs_parse('{1,2,3,4,5}', 'int4') >> 2; ?column? -------------- int4:{1,2,3} (1 row) select cs_parse('{1,2,3,4,5}', 'int4') << 10; ?column? ---------- int4:{} (1 row) select cs_parse('{1,2,3,4,5}', 'int4') >> 10; ?column? ---------- int4:{} (1 row) select cs_like('bpchar8:{Abc,aaBcc,aabbcc,abcba,aabbabcc,aabac,bca}', '%abc%'); cs_like ---------------------- char:{0,0,0,1,1,0,0} (1 row) select cs_ilike('bpchar8:{Abc,aaBcc,aabbcc,abcba,aabbabcc,aabac,bca}', '%abc%'); cs_ilike ---------------------- char:{1,1,0,1,1,0,0} (1 row) select cs_parse('{Abc,aaBcc,aabbcc,abcba,aabbabcc,aabac,bca}', 'bpchar', 8) ~~ '%abc%'; ?column? ---------------------- char:{1,1,0,1,1,0,0} (1 row) select * from CrashLog_get(); log_time | uid | country | city | device | net | os ----------------------------------------------------------------------------------------+-----------------------------------+---------------------------+----------------------------------+------------------------------------------+---------------------------------+------------------------------------- timestamp:{Mon Apr 14 11:54:00 2014,Mon Apr 14 11:55:00 2014,Mon Apr 14 11:56:00 2014} | int8:{10000001,10000002,10000003} | varchar:{USA,Japan,China} | varchar:{New York,Tokio,Beijing} | varchar:{iPhone4,Sony Xperia Z1,iPhone5} | varchar:{wifi,Vodafone 3G,wifi} | varchar:{iOS6.x,Android 4.4,iOS7.x} (1 row) select cs_project(c.*, cs_filter_pos(country = cs_str2code('USA'))) from CrashLog_get() c; cs_project -------------------------------------------------------------------------- ("Mon Apr 14 11:54:00 2014",10000001,USA,"New York",iPhone4,wifi,iOS6.x) (1 row) select cs_project(c.*, cs_filter_pos(cs_ilike(device, 'iphone%'))) from CrashLog_get() c; cs_project -------------------------------------------------------------------------- ("Mon Apr 14 11:54:00 2014",10000001,USA,"New York",iPhone4,wifi,iOS6.x) ("Mon Apr 14 11:56:00 2014",10000003,China,Beijing,iPhone5,wifi,iOS7.x) (2 rows) select cs_dictionary_size(); cs_dictionary_size -------------------- 14 (1 row)