-
Notifications
You must be signed in to change notification settings - Fork 55
Added hashing for the key in postgres if more than 63 #761
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
src/Database/Adapter/Postgres.php
Outdated
| $suffix = substr($key, $separatorPosition + 1); | ||
| } | ||
|
|
||
| $hash = hash('crc32b', $key); |
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.
Let's use md5, crc will give collision too quickly
src/Database/Adapter/Postgres.php
Outdated
| * @param string $key | ||
| * @return string | ||
| */ | ||
| protected function getIndexKey(string $key): string |
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.
Let's name this getShortKey since we use it for collections too
Postgres internally truncates the identifer name to 63 length. Now if more than that it creates issue in createCollection as duplicate indexes are generated due to truncation