REASSIGN OWNED BY in current database only

From: Andrus <kobruleht2(at)hot(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: REASSIGN OWNED BY in current database only
Date: 2021-01-15 07:45:15
Message-ID: a305fb19-3cbe-8b61-ea53-e8c2d6551a99@hot.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

Cluster contains lot databases.

All objects in database should owned by separate role  whose name is in form

databasename_owner

where databasename is this database name in cluster.

This role in granted to cluster users who should have acces to this
database.

Database is restored  from other cluster where is has different name.

After that

REASSIGN OWNED BY originaldbname_owner TO restoreddbname_owner

is used to force this role in restored database.

This command changes also owner of global objects also.

How to change  owner only in current database, leaving global objects
owner unchanged ?

Andrus.

Browse pgsql-general by date

  From Date Subject
Next Message Soni M 2021-01-15 09:13:10 could not fsync file ""pg_wal/xlogtemp.23229"": Input/output error
Previous Message Phil Florent 2021-01-15 04:45:27 RE: Strange (and good) side effect of partitioning ?