Wrong value of the new field at the old records, created before that new field 
was added.
-----------------------------------------------------------------------------------------

                 Key: CORE-5507
                 URL: http://tracker.firebirdsql.org/browse/CORE-5507
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 3.0.2
            Reporter: Vlad Khorsun


RECREATE TABLE T (ID INT NOT NULL, DESCR VARCHAR(32) NOT NULL);
COMMIT;

INSERT INTO T (ID, DESCR) VALUES (1, 'No F1 field');
COMMIT;

ALTER TABLE T ADD F1 VARCHAR(16) DEFAULT 'XYZ' NOT NULL;
COMMIT;

INSERT INTO T (ID, DESCR) VALUES (2, 'F1 field, default XYZ');
COMMIT;

SELECT * FROM T;
COMMIT;

ALTER TABLE T ALTER COLUMN F1 SET DEFAULT 'ABC';
COMMIT;

INSERT INTO T (ID, DESCR) VALUES (3, 'F1 field, default ABC');
COMMIT;

SELECT * FROM T;
COMMIT;


After the first select all is as expected:

          ID DESCR                            F1
============ ================================ ================
           1 No F1 field                      XYZ
           2 F1 field, default XYZ            XYZ

after the second select
expected

          ID DESCR                            F1
============ ================================ ================
           1 No F1 field                      ABC
           2 F1 field, default XYZ            XYZ
           3 F1 field, default ABC            ABC

actual

          ID DESCR                            F1
============ ================================ ================
           1 No F1 field                      XYZ
           2 F1 field, default XYZ            XYZ
           3 F1 field, default ABC            ABC

Note value of the field F1 at the first record: it is expected that is should 
be the same as latest DEFAULT value.
Also note that 2nd and 3rd INSERTs assigns correct value to the omitted field - 
same as latest DEFAULT value.


-- 
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