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 291A59DCC4C for ; Wed, 22 Feb 2006 14:33:08 -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 56634-09 for ; Wed, 22 Feb 2006 14:33:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pw6tiger.de (pw6tiger.de [217.160.140.116]) by postgresql.org (Postfix) with SMTP id 71DBC9DCC3A for ; Wed, 22 Feb 2006 14:33:04 -0400 (AST) Received: (qmail 21654 invoked by uid 505); 22 Feb 2006 18:33:02 -0000 Received: from vygen@gmx.de by planwerk6 by uid 89 with qmail-scanner-1.14 (virus scan: Clear:. Processed in 0.264526 secs); 22 Feb 2006 18:33:02 -0000 Received: from pd95b4e37.dip0.t-ipconnect.de (HELO bos.airliquide.de) (vygen@planwerk6.de@217.91.78.55) by pw6tiger.de with SMTP; 22 Feb 2006 18:33:02 -0000 From: Janning Vygen To: pgsql-sql@postgresql.org Subject: Re: Update in all tables Date: Wed, 22 Feb 2006 19:33:36 +0100 User-Agent: KMail/1.8.3 References: <43FCA8B0.3050803@correolux.com.mx> In-Reply-To: <43FCA8B0.3050803@correolux.com.mx> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200602221933.36387.vygen@gmx.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.148 required=5 tests=[AWL=0.148] X-Spam-Score: 0.148 X-Spam-Level: X-Archive-Number: 200602/269 X-Sequence-Number: 24279 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