There is not really a direct way to do this.
The closest thing you can do is to do this and then grant ALL to the owner (you can look up the owner in pg_class
).
One problem with doing it in this way is that default permissions could be set differently to that and that doing it purely in the backend requires using DO
with a plpgsql statement. Worse, since GRANT
is not a planned statement, you cannot parameterize it, meaning you have to do string interpolation.