Re: Changing ownership of objects

Поиск
Список
Период
Сортировка
От Manuel Sugawara
Тема Re: Changing ownership of objects
Дата
Msg-id m3adqiei85.fsf@conexa.fciencias.unam.mx
обсуждение исходный текст
Ответ на Changing ownership of objects  ("Peter Darley" <pdarley@kinesis-cem.com>)
Список 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 по дате отправления:

Предыдущее
От: Fran Fabrizio
Дата:
Сообщение: horrendous query challenge :-)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: horrendous query challenge :-)