标签:gtest rand any rom replace function lang sql int
--1.利用INTERSECT关键字数组之间交集函数 CREATE OR REPLACE FUNCTION array_intersect(anyarray, anyarray) RETURNS anyarray AS $$ SELECT ARRAY( SELECT UNNEST($1) INTERSECT SELECT UNNEST($2)); $$ LANGUAGE SQL; select array_intersect(array[1,2,3],array[2,3,4]); --2.行变列函数UNNEST select UNNEST(array[1,2,3]); --3.列变行函数array_agg: create temporary table temp_test01 as select array_agg(c) aggtest from (values(NULL),(‘1‘),(‘2‘),(‘3‘))tb(c); select UNNEST(aggtest) from temp_test01; select array_agg((id)) from (select id,md5(random()::text),clock_timestamp() from generate_series(1,100) t(id)) t1;
标签:gtest rand any rom replace function lang sql int
原文地址:http://www.cnblogs.com/binguo2008/p/7163794.html