How do I create a personalized role in postgresql

Viewed 19

I would like to create a personalized role for all the customers in the customers table of my db. I want the role name to look like client_first_name_last_name. Also, the Customer's payment and rental history must not be empty.

I have tried CREATE ROLE (SELECT DISTINCT 'client_' || c.first_name || '_' || c.last_name FROM public.customer c); but it doesn't seem to work

Is there a way to loop throught the table column and create a role for each customer?

0 Answers
Related