Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The semantics of the GUID expression is inconsistent across platforms #3167

Closed
morozov opened this issue May 27, 2018 · 2 comments
Closed

The semantics of the GUID expression is inconsistent across platforms #3167

morozov opened this issue May 27, 2018 · 2 comments
Assignees
Milestone

Comments

@morozov
Copy link
Member

morozov commented May 27, 2018

Q A
BC Break no
Version 2.7.1

Summary

As a developer, I expect the GUID expression generated by AbstractPlatform::getGuidExpression() to have the same semantic (namely, UUIDv1) across supported platforms.

Current behavior

  1. On MySQL platform, it's implemented as UUID() which generates UUIDv1 and is therefore correct.
  2. On PostgreSQL platform, it's implemented it as UUID_GENERATE_V4() which generates UUIDv4. For some reason, UUID_GENERATE_V1() is unavailable on Travis CI:

    SQLSTATE[42883]: Undefined function: 7 ERROR: function uuid_generate_v1() does not exist

  3. On Oracle platform, it's implemented as SYS_GUID() which returns RAW(16) which is not a UUID according to Stackoverflow.
  4. On SQL Server and SQLAnywhere, it's implemented as NEWID(). From the documentation, it's not clear which UUID version it generates, but according to the test output, it's not UUIDv1:

    Failed asserting that 'DBB4D428-2338-4D4F-823F-4AA2ECEC985A' is greater than 'F4959EE5-02EC-4136-A21F-211813F67B63'

  5. On SQLite, it's implemented using purely RANDOMBLOB() which makes it not compliant with the the UUIDv1 definition.

There's also a summary of the above on Wikipedia.

How to reproduce

Below is the pseudo-code. See a real example in #3162.

$previous = generateGuid();

for ($i = 0; $i < 99; $i++) {
    $value = generateGuid();
    self::assertGreaterThan($previous, $value);
    $previous = $value;
}

Expected behavior

All implementations generate UUIDv1 which looks impossible. Given the current state of the feature, would it make sense to deprecate it and encourage users to use application-generated UUIDs?

@Majkl578
Copy link
Contributor

Majkl578 commented Aug 3, 2018

Handled in #3211 and #3212.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants