Dropping default of varchar field set's field value to NULL
-----------------------------------------------------------

                 Key: CORE-5628
                 URL: http://tracker.firebirdsql.org/browse/CORE-5628
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.7
         Environment: Reproduced on Windows 8.1 Pro and Windows 10
            Reporter: Szentpéteri Annamária


ALTER TABLE SOME_TABLE
ADD NEW_FIELD VARCHAR(10)
DEFAULT 'YYY'
NOT NULL ;

COMMIT WORK;

ALTER TABLE SOME_TABLE
ALTER COLUMN NEW_FIELD
DROP DEFAULT;

I executed this script in my IBExpert script executive (but the bug comes, when 
I execute this from my program with a firebird component).

Pick a table which has some records in it.
Create a new varchar column for it, with default value and NOT NULL constraint.
If you look at your table, you will see that your new column has that default 
value for every row.

Then drop the default from your column.
If you look at your table, you will see that your new column has NULL for every 
row.

This is bad because my field is NOT NULL and I'm losing important data.

Also, if you create an integer field with the same method, the drop of default 
will not cause this.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to