Re: Update in all tables

Поиск
Список
Период
Сортировка
От Janning Vygen
Тема Re: Update in all tables
Дата
Msg-id 200602221933.36387.vygen@gmx.de
обсуждение исходный текст
Ответ на Update in all tables  (Judith <jaltamirano@correolux.com.mx>)
Список pgsql-sql
Am Mittwoch, 22. Februar 2006 19:08 schrieb Judith:
>    Hello everybody I need to update a field with the same value in the
> tables of my data base but this field exists in almost all tables and
> has the same value, I don't want to code a script, so my question is if
> there is some way to update that field with a query and affects all the
> tables that contain the field?

no. but you can do with a trigger ON UPDATE

but what is so evil about a script like this:

#!/bin/sh
TABLES="A B C D"
for TAB in $TABLES
do psql -c "UPDATE $TAB set field = 'new' where field = 'old'" mydbname;
done



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

Предыдущее
От: Judith
Дата:
Сообщение: Update in all tables
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 'locking' the SELECTs based on indices...