![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Greetings. Is it possible to modify a foreign key constraint and force it to cascade on update? If there is no such SQL command, then is it possible to update some system tables to accomplish this? |
#3
| |||
| |||
|
|
Is it possible to modify a foreign key constraint and force it to cascade on update? If there is no such SQL command, then is it possible to update some system tables to accomplish this? |
#4
| |||
| |||
|
|
Is it possible to modify a foreign key constraint and force it to cascade on update? If there is no such SQL command, then is it possible to update some system tables to accomplish this? The problem is that I have a bunch of tables with FK constraints and I need to update primary key values in a lot of these tables. FK constraints were declared, but without cascading updates. Now, I am trying to modify all of them to cascade updates so that I can change primary keys and have these changes propaged to the referencing values. What would be the easiest solution for this? |
#5
| |||
| |||
|
|
Greetings. Is it possible to modify a foreign key constraint and force it to cascade on update? If there is no such SQL command, then is it possible to update some system tables to accomplish this? |
#6
| |||
| |||
|
|
Greetings. Is it possible to modify a foreign key constraint and force it to cascade on update? If there is no such SQL command, then is it possible to update some system tables to accomplish this? |
#7
| |||
| |||
|
|
In order to find all FK declared on a table I query tg_trigger view. The query lists all FKs declared on the table as well as all the ones referencing the table. I noticed that FKs that are declared on the table have pgtype equal to 21, and FKs referencing the table have pgtype 9 or 17. The following query lists all the FKs declared table 'objective'. Is this the right way to do this? select t.tgconstrname, src.relname, dest.relname, t.tgtype from pg_trigger t, pg_class src, pg_class dest where t.tgrelid=src.oid and t.tgconstrrelid=dest.oid and t.tgisconstraint = 't' and t.tgtype=21 and src.relname='objective'; |
![]() |
| Thread Tools | |
| Display Modes | |
| |