Skip to content

Instantly share code, notes, and snippets.

Chad Nickell nickell

View GitHub Profile
View postgres_camelize_functions.sql
create or replace function camelize(text)
returns text as $$
declare parts text[] = string_to_array($1, '_');
declare capitalized_parts text[] = (select array_agg(initcap(n)) from unnest(parts) as n);
begin
return parts[1] || array_to_string(capitalized_parts[2:], '');
end;
$$ language plpgsql;
create or replace function camelize_keys(json)
You can’t perform that action at this time.