Skip to content

SQLite formatRandomInt should be enclosed in parenthesis #6

@SimonMellerin

Description

@SimonMellerin

actual version is

protected function formatRandomInt(RandomInt $expression, WriterContext $context): string
    {
        // ...
        return $this->formatRaw(
            new Raw(
                'abs(random()) % (? - ?) + ?',
                [$max, $min, $min]
            ),
            $context,
        );
    }

It could lead to unexpected behavior, see makinacorpus/DbToolsBundle#110 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions