Issue Details (XML | Word | Printable)

Key: CORE-3428
Type: Bug Bug
Status: Open Open
Priority: Blocker Blocker
Assignee: Unassigned
Reporter: sqldba
Votes: 6
Watchers: 5

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

Alter column size not possible when column used in Constraint

Created: 04/Apr/11 03:45 PM   Updated: 19/May/14 11:44 PM
Component/s: Engine
Affects Version/s: 2.1.0, 2.0.4, 2.1.1, 2.0.5, 2.1.2, 2.1.3, 1.5.6, 3.0 Initial, 2.0.6, 2.5.0, 2.1.4
Fix Version/s: None

Environment: Windows 7

 Description  « Hide
When the column is used in a constraint, altering the column size is not possible. Manually updating the RDB$Fields table also yields the same error.

CREATE TABLE test_table
   test_column VARCHAR(25) NOT NULL PRIMARY KEY.
   CHECK (test_column <> 'a')

After the table is created, you cannot increase the column length because it is used in a constraint. You would have to drop all constraints. This is very difficult if there are several constraints referring to this column. You would also have to recreate all the constraints which is very difficult in a large database.

This issue also applies to domains (this bug defeats the whole purpose of using domains). All other DBMS allow modification of column length even if it is used in a constraint. Just because Firebird [correction from: Firefox] uses it as a index, there is no excuse for this bug.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov added a comment - 04/Apr/11 03:57 PM
Name "all other DBMS". Oracle, for example prohibit changing of column type unless the column contains NULLs only.

sqldba added a comment - 04/Apr/11 04:13 PM - edited
Who said anything about changing column types? I'm talking about column lengths.

What's the purpose of a domain when you have 200+ constraints and then you have to DROP all of them and manually recreate all of them one by one just because the business requirements change and you have to increase the column length? As a sys dba, requirements change all the time and it's a PIA to adapt to them in Firebird. In a production system, this can cause a complete mess.

SQL Server let's you do this. As does Oracle.

I just don't understand why Firebird does not let you increase the column length when it's used in a constraint, have you ever worked on a production system?!?!?

Alvaro Castiello added a comment - 19/May/14 11:44 PM
I have exactly the same issue. A varchar based domain mus be increased in size and there´s no
create domain DOMAIN_THAT_NEED_RESIZE_DEF varchar(10);
alter domain DOMAIN_THAT_NEED_RESIZE_DEF type varchar(50);

since it is used in several tables, views, sp it is a real hard work to drop all constraints (and perhaps even views and the so) just to increase the domain size

Alvaro Castiello de la Hidalga