-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ignore index prefix lengths for spatial indexes #3970
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This development works for the spatial index.
Is there an ETA for when this will be merged? I'm currently waiting for this fix. |
Not a PG expert, but it looks like this wouldn't be handled by flags in PG since the syntax, which requires the PostGis extension is : CREATE INDEX nyc_census_blocks_geom_idx
ON nyc_census_blocks
USING GIST (geom); flags are apparently supposed to appear between PostGIS does not seem to be supported though (and will never be?) |
Also, the linked issue shows that this piece of code is responsible for the length appearing: dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php Lines 69 to 71 in 22800bd
Why not change it so that the length is not set at all in case the index is spatial? |
yield ['spatial', 'spatial', [], [], true]; | ||
yield ['spatial', 'spatial', [], [32], true]; | ||
yield ['spatial', 'spatial', [32], [32], true]; | ||
yield ['spatial', 'spatial', [32], [24], true]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a data provider for a spatial index test, why do we care about testing the length comparison? If the logic of comparison of the flags and lengths needs to be tested, it's better to do it in a separate test that would not get too much into the details of why the lengths or flags mismatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are testing if the method isFullfilledBy
works as expected in different cases. When spatial index created or migration is generated (or checked) on different platforms: MySQL, AWS Aurora MySQL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine but some of these different cases are better to be implemented as a separate test method. Otherwise, if someone breaks the length comparison logic and testFulfilledSpatialIndex()
fails, it will be misleading feedback from the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a text key on data providers would also give more information to a failing test with a data row, but separate test cases provide a more contextual structure for the test class.
I like this idea. |
@ksaveras 2.10.x only accepts security fixes now, retargeting to 2.11.x . |
should help with the cs issues. |
Thanks @greg0ire |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d7ab498
to
7b6464d
Compare
We already have a contributing guide, but no link to it, which sounds a bit weird. Good point, I will make a PR later to address that. UPD: See #4299 |
Travis got confused with the 2 PRs, let's close and reopen to trigger a new build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misunderstood the boolean logic being tested when requested the changes in #3970 (comment). Makes sense.
7b6464d
to
0bf1fd5
Compare
While the patch addresses this issue, I can hardly see it being a bug. DBAL does not claim the support for portability between MySQL and Aurora, in which case it would be a bug. I don't know enough about how index length is applied to spatial indexes, so it is possible that it's a breaking change while the primary focus of UPD: as pointed out in the documentation mentioned in #3561.
So it is sort of a bug. |
@ksaveras what does MySQL report as the spatial index dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php Lines 66 to 71 in 22800bd
E.g. not use |
Hi, we have the same issue. How can we help getting merged this PR? |
@ottaviano this patch requires integration testing. This may shed some light on how #3970 (comment) should be addressed. |
Superseded by #4525. |
Summary
MySQL spatial indexes do not support index lengths and this check should be skipped.
If there are MSSQL or PGSQL experts - please comment.
This PR skips index lengths check if both indexes have a spatial flag.
I.e. when an index is created, MySQL 5.7 creates with 32 bytes prefix length. AWS Aurora (MySQL 5.7 compatible) - 24 bytes prefix length.