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

Disable constraint [CORE1924] #2358

Open
firebird-automations opened this issue Jun 6, 2008 · 7 comments
Open

Disable constraint [CORE1924] #2358

firebird-automations opened this issue Jun 6, 2008 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @cincuranet

Votes: 14

Temporaly disabling constraints (FK, check, ...) using:
ALTER TABLE <table> DISABLE <constraint> and ALTER TABLE <table> ENABLE <constraint>

This more or less similar to CORE1084, but with wider application.

@firebird-automations
Copy link
Collaborator Author

Commented by: Mark Stein (mark stein)

It would be great to have such a functionality!

I'm looking for a way do achieve that, but can't find anything.

This article:
http://www.firebirdfaq.org/faq20/

says "[...]Alternatively, you can disable the constraints during the import and turn them back on later.[...]"

so it seems to be possible. I would like to know how.

Can anyone help me with this please?

If this is not possible yet, then please consider it for one of the next releases.

Thanks,
Mark

@aafemt
Copy link
Contributor

aafemt commented Apr 5, 2024

If standard-compliant ALTER TABLE ALTER CONSTRAINT [NOT] ENFORCED is implemented for PK/UK/FK, should equivalent ALTER TRIGGER INACTIVE to be allowed too?
The same question for activation/deactivation of triggers for CHECK constraints.

@dyemanov
Copy link
Member

dyemanov commented Apr 8, 2024

If standard-compliant ALTER TABLE ALTER CONSTRAINT [NOT] ENFORCED is implemented for PK/UK/FK, should equivalent ALTER INDEX INACTIVE to be allowed too? The same question for activation/deactivation of triggers for CHECK constraints.

I'd prefer it raising an error and suggesting to use ALTER CONSTRAINT instead, but it will break backward compatibility.

If it's allowed, I'd expect the change to be propagated to the constraint using the altered index/trigger, as the state should be stored at the constraint level too and both states should be in sync.

@aafemt
Copy link
Contributor

aafemt commented Apr 8, 2024

Why to duplicate the state? As any other denormalization it is just a source of troubles.

@dyemanov
Copy link
Member

dyemanov commented Apr 8, 2024

We're going to support FKs without indices, so the state should be stored at the constraint level.

@hvlad
Copy link
Member

hvlad commented Apr 8, 2024

Not every kind of constraints requires index ever

@aafemt
Copy link
Contributor

aafemt commented Apr 8, 2024

Ok, but let's wait until FKs without indices are implemented to see implementation details and if they don't have a place for "active" flag.

PS: Check constraints require triggers which also have own "inactive" flag. NULL constraints have corresponding flags in record format IIRC.

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

4 participants