Re: Changing ownership of objects - Mailing list pgsql-general

From Manuel Sugawara
Subject Re: Changing ownership of objects
Date
Msg-id m3adqiei85.fsf@conexa.fciencias.unam.mx
Whole thread Raw
In response to Changing ownership of objects  ("Peter Darley" <pdarley@kinesis-cem.com>)
List pgsql-general
"Peter Darley" <pdarley@kinesis-cem.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.

pgsql-general by date:

Previous
From: Fran Fabrizio
Date:
Subject: horrendous query challenge :-)
Next
From: Tom Lane
Date:
Subject: Re: horrendous query challenge :-)