postgresql create all tables in schema with schema owner not the postgres default

Viewed 2252

How to get all the tables I create to have the schema owner as the table owner?

In a database called layers, I have a schema called hi_ow and the owner is hi_ow. when I run a create table command it creates the table in the hi_ow schema but the owner is defaulted to Postgres

example:

drop table if exists hi_ow.how_dump;
create table hi_ow.how_dump as
select (st_dump(geom)).geom geom from hi_ow.how;

I know I can just run

alter table hi_ow.how owner to hi_ow

but I want the default owner for just THIS schema to be hi_ow

Is there some sort of set owner = hi_ow before I run multiple queries? Or something in the schemas settings I need to enable?

The reassign command does not work for me because the tables I am trying to switch ownership from are owned by Postgres.

0 Answers
Related