|
Home > Archive > PostgreSQL SQL > February 2006 > Update in all tables
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Update in all tables
|
|
| Judith Altamirano Figueroa 2006-02-25, 9:48 am |
| 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?
Thanks in advanced, regards!!!
| |
| Scott Marlowe 2006-02-25, 9:48 am |
| 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:
>
> 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.
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
| |
| Owen Jacobson 2006-02-25, 9:48 am |
| Scott Marlowe wrote:
> On Wed, 2006-02-22 at 15:13, Andrew Sullivan wrote:
>
>
> Unless they're all FK/PK pairs, in which case you on update / delete
> cascade FKs.
It's entirely too bad this has to be designed into the DDL for the table. It'd be nice if you could specify "CASCADE" on UPDATE or DELETE queries. I don't see that it's any more of a gun than ON UPDATE/ON DELETE CASCADE in the foreign key definition.
-Owen
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
| |
| Andrew Sullivan 2006-02-25, 9:48 am |
| 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).
A
--
Andrew Sullivan | ajs@crankycanuck.ca
Unfortunately reformatting the Internet is a little more painful
than reformatting your hard drive when it gets out of whack.
--Scott Morris
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
|
|
|
|
|