Advertisement
joaofabioma

function nomes1

May 25th, 2022
1,021
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- FUNCTION: public.nomes1()
  2.  
  3. -- DROP FUNCTION IF EXISTS public.nomes1();
  4.  
  5. CREATE OR REPLACE FUNCTION public.nomes1(
  6.     )
  7.     RETURNS text
  8.     LANGUAGE 'plpgsql'
  9.     COST 50
  10.     VOLATILE LEAKPROOF PARALLEL UNSAFE
  11. AS $BODY$
  12. DECLARE
  13.     vretorno TEXT;
  14. BEGIN
  15.     SELECT
  16.         initcap(string_agg(x,'')) INTO vretorno
  17.     FROM (
  18.         select start_arr[ 1 + ( (random() * 25)::int) % 31 ]
  19.         FROM
  20.         (
  21.             select '{ro,re,pi,co,jho,bo,ba,ja,mi,pe,da,an,en,sy,vir,nath,so,mo,aĆÆ,che,cha,dia,n,nn,hn,b,t,gh,ri,hen,ng}'::text[] as start_arr
  22.         ) syllarr,
  23.         -- need 3 syllabes, and force generator interpretation with the '*0' (else 3 same syllabes)
  24.         generate_series(1, 3 +1)
  25.     ) AS con_name_first(x);
  26.     RETURN vretorno;
  27. END;
  28. $BODY$;
  29.  
  30. ALTER FUNCTION public.nomes1()
  31.     OWNER TO postgres;
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement