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

ALTER TABLE - DROP/ADD columns in a single statement [CORE429] #774

Open
firebird-automations opened this issue Jul 4, 2003 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @dyemanov

Votes: 1

SFID: 765844#⁠
Submitted By: dimitr

The DDL statement like the following:
ALTER TABLE DROP COL1, ADD COL2 INT;
may fail because of "found dependancies", if database
was just restored from a backup.

The reason is simple. The engine executes parts of this
statement in order of declaration, i.e. firstly COL1 will be
dropped and then COL2 will be created. But restore
initializes all system generators with zero, so when a
system domain for COL2 is being created, there's a
chance that it will have exactly the same name as just
removed domain for COL1 had (first unused position from
RDB$0).

So we have (for example):
1) domain RDB$17 is deleted for COL1
2) domain RDB$17 is inserted for COL2
3) DFW manager checks for dependencies on RDB$17
and... we're in trouble, because such a dependency
already exists.

A current workaround is changing the order of
modifications in ALTER TABLE clause, placing ADD
commands before DROP ones, e.g:
ALTER TABLE ADD COL2 INT, DROP COL1;

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 10453 ] => Firebird [ 14746 ]

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