Re: Implementing automatic updating of primary keys...
От
Tomasz Myrta
Тема
Re: Implementing automatic updating of primary keys...
Дата
Msg-id
3E12E207.9020504@klaster.net
Ответ на
Implementing automatic updating of primary keys... (Rajesh Kumar Mallah.)
Список
Дерево обсуждения
Implementing automatic updating of primary keys... "Rajesh Kumar Mallah." <mallah@trade-india.com>
Re: Implementing automatic updating of primary keys... Tomasz Myrta <jasiek@klaster.net>
Re: Implementing automatic updating of primary keys... "Rajesh Kumar Mallah." <mallah@trade-india.com>
Re: Implementing automatic updating of primary keys... Bhuvan A <bhuvansql@myrealbox.com>
Rajesh Kumar Mallah. wrote: >Hi we are working on re-structuring our database schemas and >intend to implement the functionality below at database level. > >consider a master table with following data. > > >Table: profile_master >------------ > >id | username | password >---|----------|---------- >1 | u1 | p1 >2 | u2 | p2 > >id--> primary key not null. > >can some thing be done in the database level it self so that we do not have >to keep modifying the mantainence programs as the number of tables referencing >master table grows? > >regds >mallah. If I understood well you want to change id in all tables from some value into another one and no matter, how many these tables exist? First - if your tables are created with "on update cascade", you can just change value on master table. If you didn't create tables with this option and referencing key has the same name in all tables, it isn't still too difficult. Everything you need is a function which finds all tables with field "id" and for each table performs: update
В списке pgsql-sql по дате отправления
От: Rajesh Kumar Mallah.
Дата:
От: Rajesh Kumar Mallah.
Дата: