I want to create a new table with plpgsql, but I want that the user gives the name of the table.My code generate a table with the name of tbname
this is my code:
CREATE OR REPLACE FUNCTION "Object_gen"(tablename text)
RETURNS void AS
$BODY$DECLARE
tbname text;
BEGIN
tbname:=tablename;
CREATE TABLE tbname(Surrogat uuid);
END$BODY$
LANGUAGE plpgsql;
How can I solve my problem? somehow that the name of my table comes from the user