Re: Changing column names in tables 2

Поиск
Список
Период
Сортировка
От Nis Jørgensen
Тема Re: Changing column names in tables 2
Дата
Msg-id fqpr07$7bs$1@ger.gmane.org
обсуждение исходный текст
Ответ на Changing column names in tables 2  ("Tony Cade" <arcade646@googlemail.com>)
Список pgsql-general
Tony Cade skrev:

>     select relfilenode from pg_class where relname='rates'
>
> update  pg_attribute set attname=lower(attname) where attnum >0 and
> attrelid=nnnn ( from above query)

Instead of the second one, do

SELECT
'ALTER TABLE rates RENAME COLUMN ' || attname || ' TO ' ||
lower(attname) || ';'
FROM pg_attribute
WHERE attnum >0 AND attrelid=nnnn

Output to textfile, run through psql

Not tested,

Nis

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: staring pgsql on fedora 8
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: contributing patches