1-- 2-- num_nulls() 3-- 4 5SELECT num_nonnulls(NULL); 6SELECT num_nonnulls('1'); 7SELECT num_nonnulls(NULL::text); 8SELECT num_nonnulls(NULL::text, NULL::int); 9SELECT num_nonnulls(1, 2, NULL::text, NULL::point, '', int8 '9', 1.0 / NULL); 10SELECT num_nonnulls(VARIADIC '{1,2,NULL,3}'::int[]); 11SELECT num_nonnulls(VARIADIC '{"1","2","3","4"}'::text[]); 12SELECT num_nonnulls(VARIADIC ARRAY(SELECT CASE WHEN i <> 40 THEN i END FROM generate_series(1, 100) i)); 13 14SELECT num_nulls(NULL); 15SELECT num_nulls('1'); 16SELECT num_nulls(NULL::text); 17SELECT num_nulls(NULL::text, NULL::int); 18SELECT num_nulls(1, 2, NULL::text, NULL::point, '', int8 '9', 1.0 / NULL); 19SELECT num_nulls(VARIADIC '{1,2,NULL,3}'::int[]); 20SELECT num_nulls(VARIADIC '{"1","2","3","4"}'::text[]); 21SELECT num_nulls(VARIADIC ARRAY(SELECT CASE WHEN i <> 40 THEN i END FROM generate_series(1, 100) i)); 22 23-- special cases 24SELECT num_nonnulls(VARIADIC NULL::text[]); 25SELECT num_nonnulls(VARIADIC '{}'::int[]); 26SELECT num_nulls(VARIADIC NULL::text[]); 27SELECT num_nulls(VARIADIC '{}'::int[]); 28 29-- should fail, one or more arguments is required 30SELECT num_nonnulls(); 31SELECT num_nulls(); 32 33-- 34-- Test some built-in SRFs 35-- 36-- The outputs of these are variable, so we can't just print their results 37-- directly, but we can at least verify that the code doesn't fail. 38-- 39select * from (select pg_ls_dir('.') a) a where a = 'base' limit 1; 40 41select * from (select (pg_timezone_names()).name) ptn where name='UTC' limit 1; 42 43select count(*) > 0 from 44 (select pg_tablespace_databases(oid) as pts from pg_tablespace 45 where spcname = 'pg_default') pts 46 join pg_database db on pts.pts = db.oid; 47