[ISSUE-17793] UUID - Fix insert error

Signed-off-by: Mo Sureerat <sureemo@gmail.com>
This commit is contained in:
Mo Sureerat 2022-11-03 05:55:37 +07:00
parent ddf928e6f3
commit 15e629c9c1
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(