Project

General

Profile

Bug #7220

Record not created when property is set to empty string

Added by Dănuț Filimon over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

Related issues

Related to Database - Bug #7108: Simulate upper/rtrim directly in H2 using case specific columns Closed

History

#1 Updated by Dănuț Filimon over 1 year ago

Found an issue related to persistent tables where a record is not created when the property is set to an empty string.
Here is the test case where pt1 is the persistent table with a character field key:

DEFINE VARIABLE cVar AS CHARACTER.

CREATE pt1.
pt1.key = "".
RELEASE pt1.

cVar = " ".
FIND FIRST pt1 WHERE pt1.key = cVar.

The find statement fails because there is no record found.

#2 Updated by Dănuț Filimon over 1 year ago

  • Related to Bug #7108: Simulate upper/rtrim directly in H2 using case specific columns added

#3 Updated by Ovidiu Maxiniuc over 1 year ago

Interesting finding.

The record is not forced to flush to DB when it was created. The 'touch' marks the field as dirty but does not mark the record as changed.
When the release is performed (RecordBuffer.setCurrentRecord(), line ~11411), the record appears as NEW and TRACKED but not CHANGED so doFlush == false. The record from buffer is dropped but never saved. It vanishes as it never existed.

Interestingly, if the find had been executed before the release, the record would have been created because the record nursery makes it forcefully visible at that moment.

We need to be sure that, if the record is still NEW (even if not CHANGED) at the time the buffer is released or other record loaded into it, the old record MUST be flushed (inserted actually) into database.

#4 Updated by Alexandru Lungu over 1 year ago

I remember that Danut also tested the example with a temporary table. In that case, the record was found because isAutoCommit was true. We should find a test-case for which isAutoCommit is implementing an original 4GL behavior. I am concerned that we may rush to fix this and regress the isAutoCommit in some way.

Also available in: Atom PDF