Merge #17864 - Fix #17793 - insert record - fix null not selected if nullable UUID & insert error

Pull-request: #17860
Fixes: #17793

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2022-11-03 20:36:55 +01:00
commit c00a904827
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 19 additions and 1 deletions

View File

@ -1746,7 +1746,7 @@ class InsertEdit
if (
$editField->type === 'uuid'
&& ! $editField->isNull
&& in_array($editField->value, ["''", '', "'uuid()'"], true)
&& in_array($editField->value, ["''", '', "'uuid()'", 'uuid()'], true)
) {
return 'uuid()';
}

View File

@ -2768,6 +2768,24 @@ class InsertEditTest extends AbstractTestCase
$this->assertEquals('`fld` = uuid()', $result);
// Test that the uuid function as a value uses the uuid function to generate a value
$result = $this->insertEdit->getQueryValueForUpdate(
new EditField(
'fld',
'uuid()',
'uuid',
false,
false,
false,
'',
null,
'',
false
)
);
$this->assertEquals('`fld` = uuid()', $result);
// Test that the uuid type does not have a default value other than null when it is nullable
$result = $this->insertEdit->getQueryValueForUpdate(
new EditField(