Move a table to another schema

Поиск
Список
Период
Сортировка
От Lee Kindness
Тема Move a table to another schema
Дата
Msg-id 16312.61872.303145.799444@kelvin.csl.co.uk
обсуждение исходный текст
Ответы Re: Move a table to another schema
Re: Move a table to another schema
Список pgsql-general
I have many tables created in the "public" schema and I would like to
migrate these into an "x001" schema. Unfortunately there is no ALTER
TABLE construct for this... The following SQL would seem to move the
"zxc" table from "public.zxc" to "x001.zxc":

 UPDATE pg_class
  SET   relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'x001')
  FROM  pg_namespace
  WHERE pg_class.relname      = 'zxc'    AND
        pg_namespace.nspname  = 'public' AND
        pg_class.relnamespace = pg_namespace.oid

Has anyone else addressed this before? Recommendations?

Thanks, L.

В списке pgsql-general по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Alternative cluster location
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Alternative cluster location