X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5FC499DC86E for ; Wed, 22 Feb 2006 17:16:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81051-07 for ; Wed, 22 Feb 2006 17:16:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 4A0EE9DC832 for ; Wed, 22 Feb 2006 17:16:24 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 22 Feb 2006 21:16:26 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 22 Feb 2006 15:16:26 -0600 Subject: Re: Update in all tables From: Scott Marlowe To: Andrew Sullivan Cc: pgsql-sql@postgresql.org In-Reply-To: <20060222211348.GE8741@phlogiston.dyndns.org> References: <1140631146.5580.5.camel@Desarrollo> <20060222211348.GE8741@phlogiston.dyndns.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1140642986.5777.39.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 22 Feb 2006 15:16:26 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.156 required=5 tests=[AWL=0.155, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.156 X-Spam-Level: X-Archive-Number: 200602/274 X-Sequence-Number: 24284 On Wed, 2006-02-22 at 15:13, Andrew Sullivan wrote: > On Wed, Feb 22, 2006 at 11:59:06AM -0600, Judith Altamirano Figueroa wrote: > > 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, sorry. While we're at it, though, if you have the same field in > several tables, it's a good sign that your database is badly > normalised. You shouldn't have to update more than one table (which > is why there isn't a way to do this automatically). Unless they're all FK/PK pairs, in which case you on update / delete cascade FKs.