Create a new Table with a parameterized name

Hi everyone postgres noob here, I have a seemingly simple function that I want to take an input and create a table that takes in a parameter and then creates a table with the parameter name with an arbitrary schema.
CREATE OR REPLACE FUNCTION add_token_table(token_name text)
returns void as $$ 
BEGIN
   execute format(
     'create table', token_name, '(hexBalance text)'
   );
END
$$ language plpgsql


What am I missing here, also I haven't found anything that is terribly too helpful for writing these kinds of postgres functions so if anyone has any resources that help them write these sorts of functions easily, also feel free to drop those as well, Thanks
Was this page helpful?