Re: Changing ownership of objects

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: "Peter Darley" <pdarley(at)kinesis-cem(dot)com>
Cc: "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Changing ownership of objects
Date: 2002-05-29 21:50:50
Message-ID: m3adqiei85.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

"Peter Darley" <pdarley(at)kinesis-cem(dot)com> writes:

> Friends, When I was young and foolish and setting up my DB initially
> I ended up with the objects in my DB owned by random users. I'd
> like to write a script to change the user for all objects to be the
> same, but I don't see any way to change the ownership of sequences.
> Any ideas? Thanks, Peter Darley

If you are using some sh descendant somthing like:

for x in `psql -c '\dts' mydb -tA | cut -d\| -f1`; do
psql -c "ALTER TABLE $x OWNER TO newowner;" mydb
done

should do the work.

Regards,
Manuel.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jillian Carroll 2002-05-29 22:23:59 Database Ownership
Previous Message Fran Fabrizio 2002-05-29 21:30:18 horrendous query challenge :-)

Browse pgsql-novice by date

  From Date Subject
Next Message Jillian Carroll 2002-05-29 22:23:59 Database Ownership
Previous Message Rory Campbell-Lange 2002-05-29 21:48:55 Re: Fantasy Football complex select