From: Janning Vygen <vygen@gmx.de>
To: pgsql-sql@postgresql.org
Subject: Re: Update in all tables
Date: Wed, 22 Feb 2006 19:33:36 +0100
Message-ID: <200602221933.36387.vygen@gmx.de> (raw)
In-Reply-To: <43FCA8B0.3050803@correolux.com.mx>
References: <43FCA8B0.3050803@correolux.com.mx>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: vygen@gmx.de
Subject: Re: Update in all tables
In-Reply-To: <200602221933.36387.vygen@gmx.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox