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