Issue Details (XML | Word | Printable)

Key: CORE-4408
Type: New Feature New Feature
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Evelyne Girard
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

Merge records referenced by FK

Created: 28/Apr/14 03:52 PM   Updated: 28/Apr/14 03:52 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

 Description  « Hide
It would be nice to be able to merge a record referenced by Foreign Keys with another and have the server performing a cascade update instead of having to update all the tables referencing this record and then delete the referenced record.

Example :
Table Patient (Patient_ID integer not null primary key);
Table Visit (Visit_ID integer not null primary key,
Patient_ID integer not null,
constraint FK_Visit_Patient foreign key (Patient_ID) references Patient(Patient_ID) on update cascade on delete no action);

if Patient_ID 2 is effectively the same patient as Patient_ID 1 and I want to merge those two records, I have to do:
Update Visit set Patient_ID = 1 where Patient_ID = 1; --And the same on the dozen of dependant tables
Delete from Patient where Patient_ID=2;

If this could be done with one action (something like "merge patient set patient_id=:NewValue where Patient_Id=:OldValue) it would save having to create a Stored Procedure to execute each updates on then foreign keys...

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.