Allow for changing owner of all tables in psql db

This commit is contained in:
The StarOpenSource Project 2024-03-15 02:18:24 +01:00
parent d71f8f7e01
commit ef3e134c11
2 changed files with 3 additions and 0 deletions

2
soscmd-postgresql-changeowner Executable file
View file

@ -0,0 +1,2 @@
echo "Execute this:"
cat /opt/soscmd/soscmd-postgresql-changeowner.txt

View file

@ -0,0 +1 @@
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB` ; do psql -c "alter table \"$tbl\" owner to NEW_OWNER" YOUR_DB ; done