Issue Details (XML | Word | Printable)

Key: CORE-5492
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Alfonso Presa
Votes: 0
Watchers: 2

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

Add a new foreign not null field to a populated table

Created: 01/Mar/17 05:04 AM   Updated: 01/Mar/17 10:06 AM
Component/s: Engine
Affects Version/s: 3.0.1
Fix Version/s: None

Environment: All

QA Status: No test

 Description  « Hide
Previosly when updating a table with a script Firebird admitted a to add a not NULL field without a Default value. I understand the reasons why it changed but what about trying to add a NOT NULL Foreign Key to a populated table? Of course it is impossible because you cannot define a Default Value or the data would be inconsistent or you have to use a "non visible row" to accomplish it. This "improvement" is a huge problem for many of us.
I use extensive use of scripts to update my customers and this change ban me from Firebird 3 becasue I cannot find a way to workaround this.

Thanks in advance,

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Gabor Boros added a comment - 01/Mar/17 10:06 AM
First create the new field without NOT NULL. Then set its value to a non null value. After switch on the NOT NULL on the field, for example ALTER TABLE TABLE1 ALTER FIELD1 SET NOT NULL;
Please read "Manage Nullability in Domains and Columns" section in the release notes of 3.0.x.