Fix SQL UPDATE UPSERT with RETURN BEFORE to return empty record when new record is created
@@ -46,9 +46,11 @@ public class CopyRecordContentBeforeUpdateStep extends AbstractExecutionStep {
if (rec instanceof ODocument) {
prevValue.setProperty("@class", ((ODocument) rec).getSchemaClass().getName());
}
+ if (!result.toElement().getIdentity().isNew()) {
for (String propName : result.getPropertyNames()) {
prevValue.setProperty(propName, OLiveQueryHookV2.unboxRidbags(result.getProperty(propName)));
}
+ }
((OUpdatableResult) result).previousValue = prevValue;
} else {
throw new OCommandExecutionException("Cannot fetch previous value: " + result);
