Search Postgresql Archives

Re: Advice on merging two primary keys...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric D. Nielsen wrote:
I've come into a situation where I will often need to merge two primary keys, with numerous foreign keys hanging off of them. For instance:

While any update of the either primary key will cascade to all relevant tables, such an update is disallowed for uniqueness reasons.

Is there a good SQL-base method to accomplish this type of merging or does this need application logic?

It's irritating, because (afaict) the main use for cascading updates to a primary key is for merging. But, without deferred uniqueness checks you'll encounter the problem you mention. PG doesn't allow deferred uniqueness checks at the moment, so I'm afraid you'll have to explicitly update all the dependant tables.

--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux