Re: alter multiple tables

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: alter multiple tables
Дата
Msg-id 49BE7969.8050008@wildenhain.de
обсуждение исходный текст
Ответ на alter multiple tables  ("Kodok Marton" <marton@mybusinessanywhere.com>)
Список pgsql-general
Hi,

Kodok Marton wrote:
> Hello,
>
> I have in every table columns like:
> username character varying(20) NOT NULL
>
> I want to extend the length of varchar in all tables.

next time you should probably consider using a domain type
(or stick to text)

> Since I have a lot of tables and mirrored backups, I am wondering if
> there is a way to alter automatically all tables where colname matches
> 'username'
>
> Is there a way to do this?

It should be possible to generate a list of tables either via
query or using pg_dump -L with grep and create SQL based on this
(with a script, unix shell) and execute it against the database.

(Test this of course)

HTH
Tino

Вложения

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

Предыдущее
От: "Kodok Marton"
Дата:
Сообщение: alter multiple tables
Следующее
От: "Kodok Marton"
Дата:
Сообщение: Re: alter multiple tables