clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2805438 fiddles created (40856 in the last week).

CREATE OR REPLACE FUNCTION f_array_to_string_with_quotes(_arr text[], _quote text = '"') RETURNS text LANGUAGE sql IMMUTABLE PARALLEL SAFE AS $func$ SELECT $2 || array_to_string($1, $2 || ', ' || $2) || $2 $func$;
 hidden batch(es)


-- double quotes SELECT f_array_to_string_with_quotes('{"Boa vista",Urbana,Rural,Indigena}', '"');
f_array_to_string_with_quotes
"Boa vista", "Urbana", "Rural", "Indigena"
 hidden batch(es)


-- same since " is default for $2 SELECT f_array_to_string_with_quotes('{"Boa vista",Urbana,Rural,Indigena}');
f_array_to_string_with_quotes
"Boa vista", "Urbana", "Rural", "Indigena"
 hidden batch(es)


-- single quotes SELECT f_array_to_string_with_quotes('{"Boa vista",Urbana,Rural,Indigena}', '''');
f_array_to_string_with_quotes
'Boa vista', 'Urbana', 'Rural', 'Indigena'
 hidden batch(es)