Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge records referenced by FK [CORE4408] #4730

Open
firebird-automations opened this issue Apr 28, 2014 · 0 comments
Open

Merge records referenced by FK [CORE4408] #4730

firebird-automations opened this issue Apr 28, 2014 · 0 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Evelyne Girard (evelyne)

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant