Issue Details (XML | Word | Printable)

Key: CORE-429
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Dmitry Yemanov
Votes: 1
Watchers: 0
Operations

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

ALTER TABLE - DROP/ADD columns in a single statement

Created: 04/Jul/03 12:00 AM   Updated: 14/Jun/06 09:39 AM
Component/s: Engine
Affects Version/s: None
Fix Version/s: None

SF_ID: 765844


 Description  « Hide
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;

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