New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible NULL in NOT NULL-Field [CORE6416] #6654
Comments
Commented by: @pavel-zotov I get value = 0 (zero) instead of null for this example. C:\FBTESTING\qa\misc>C:\FB\30Cs\isql -q -z -i c6416.sql shell del C:\temp\tmp4test.fdb 2>nul; create table test_audit ( create table test_work ( set term ^ ; -- 2. execute insert record, but rollback the transaction. -- 3. set new_field as not null: -- 4. execute insert record and commit the transaction. -- 5. check values: ID 1 |
Commented by: Maxim Kuzmin (cybermax) I'm testing your example on 4.0.2076 and have a same result - nulls in altered fields. |
Commented by: @pavel-zotov On 4.0.0.2225 result is expected: C:\FBTESTING\qa\misc>C:\FB\40SS\isql -q -z -i c6416.sql shell del C:\temp\tmp4test.fdb 2>nul; create table test_audit ( -- 3. set new_field as not null: -- 4. execute insert record and commit the transaction. |
Commented by: @pavel-zotov ... and on 4.0.0.2076 result is: -- 5. check values: ID 1 -- but NOT nulls. |
Commented by: Maxim Kuzmin (cybermax) Pavel Zotov, you are right, test script in isql shows not nulled values. But I added drop not null and get next result: Cmd: ID 1 isql by yourself replace a NULL's to default value. |
Commented by: Maxim Kuzmin (cybermax) Pavel Zotov, I'm tested other version. |
Commented by: @pavel-zotov > But I added drop not null and get next result: You have initially pointed that problem relates to field that is declared as NOT null. |
Commented by: Maxim Kuzmin (cybermax) > For what here to do 'DROP not null' ? We get expected result here, isn't ? Log from restore: |
Commented by: @dyemanov Re-connect between steps (3) and (4) should cure the issue. AFAIU, trigger TEST_TABLE_2_AI0 caches the original definition of the table TEST_TABLE and doesn't see the added constraint. As soon as this trigger is reloaded inside the matadata cache, the problem disappears. |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Submitted by: Maxim Kuzmin (cybermax)
Steps for reproduce:
1. Create tables.
CREATE TABLE TEST_TABLE (
ID INTEGER NOT NULL,
NEW_FIELD INTEGER
);
CREATE TABLE TEST_TABLE_2 (
ID INTEGER NOT NULL
);
SET TERM ^ ;
CREATE OR ALTER TRIGGER TEST_TABLE_2_AI0 FOR TEST_TABLE_2
ACTIVE AFTER INSERT POSITION 0
AS
BEGIN
INSERT INTO TEST_TABLE(id) values(http://new.id);
END
^
SET TERM ; ^
2. Execute insert record, but rollback the transaction.
INSERT INTO TEST_TABLE_2(ID) VALUES (1)
3. Set NEW_FIELD as NOT NULL:
ALTER TABLE TEST_TABLE ALTER NEW_FIELD SET NOT NULL
4. Execute insert record and commit the transaction.
INSERT INTO TEST_TABLE_2(ID) VALUES (1)
5. Check values:
SELECT * FROM TEST_TABLE:
ID NEW_FIELD
1 <NULL>
The text was updated successfully, but these errors were encountered: