-
Notifications
You must be signed in to change notification settings - Fork 6
[Gel] Use unaccent extension for sorting ignoring accents #3487
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
📝 WalkthroughWalkthroughThe changes integrate the PostgreSQL Changes
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
dbschema/common.gel
(1 hunks)dbschema/migrations/00022-m1p34dr.edgeql
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: E2E Tests (neo4j 1/6)
- GitHub Check: E2E Tests (neo4j 4/6)
- GitHub Check: Clean
- GitHub Check: Generate (head)
- GitHub Check: E2E Tests (neo4j 6/6)
- GitHub Check: E2E Tests (neo4j 3/6)
- GitHub Check: E2E Tests (neo4j 5/6)
- GitHub Check: Generate (base)
- GitHub Check: E2E Tests (neo4j 2/6)
- GitHub Check: Unit
- GitHub Check: lint
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (actions)
🔇 Additional comments (3)
dbschema/common.gel (2)
1-1
: LGTM: Extension declaration is correct.The
using extension pg_unaccent;
declaration properly imports the PostgreSQL extension for use in EdgeDB.
12-18
:❌ Incorrect review comment
Critical inconsistency: Regex pattern differs from migration.
The regex pattern in this file
'[ [\\]|,\\-$]+'
doesn't match the pattern in the migration filer'[ [\]|,\-$]+'
. This inconsistency could lead to different behavior between the migrated function and the schema definition.The patterns have different escaping:
- Schema:
'[ [\\]|,\\-$]+'
(double backslashes)- Migration:
r'[ [\]|,\-$]+'
(raw string with single backslashes)Please ensure both files use the same regex pattern. The intended pattern should likely be:
- str_trim(re_replace('[ [\\]|,\\-$]+', ' ', value, flags := 'g')), + str_trim(re_replace('[ \\[\\]|,\\-$]+', ' ', value, flags := 'g')),Run this script to verify consistency between schema and migration:
🏁 Script executed:
#!/bin/bash # Check for regex pattern consistency between schema and migration files echo "=== Schema file pattern ===" grep -n "re_replace" dbschema/common.gel echo "=== Migration file pattern ===" grep -n "re_replace" dbschema/migrations/00022-m1p34dr.edgeql echo "=== Pattern comparison ===" echo "If patterns differ, this needs to be resolved for consistency"Length of output: 635
Patterns are equivalent – no change needed
The schema’s normal‐string literal (
'[ [\\]|,\\-$]+'
) and the migration’s raw‐string literal (r'[ [\]|,\-$]+'
) both compile to the same character class (matching space,[
,]
,|
,,
,-
, and$
). The differences are purely in how backslashes are escaped in the two string formats. No updates are required.Likely an incorrect or invalid review comment.
dbschema/migrations/00022-m1p34dr.edgeql (1)
4-4
:✅ Verification successful
Verify PostgreSQL extension version availability.
The migration creates
pg_unaccent
at version '1.1'. Please ensure this version is available in your target PostgreSQL environments.
🌐 Web query:
What versions of the PostgreSQL pg_unaccent extension are available and what is the latest stable version?
💡 Result:
The PostgreSQL extension is called "unaccent" (not "pg_unaccent"), and it's used for removing accents or diacritic signs from text to make searching and text comparisons more flexible across different languages.
Available Versions
Based on the search results, the unaccent extension is consistently available as version 1.1 across multiple PostgreSQL versions:
- PostgreSQL 17: version 1.1[1][4]
- PostgreSQL 16: version 1.1[4]
- PostgreSQL 15: version 1.1[4]
- PostgreSQL 14 and earlier: version 1.1[3][4]
This consistency in versioning suggests that unaccent has been stable at version 1.1 for quite some time. The extension is supported across various PostgreSQL database services including:
- Amazon RDS for PostgreSQL[1]
- Amazon Aurora PostgreSQL[3]
- Microsoft Azure PostgreSQL[4]
- Google Cloud SQL for PostgreSQL[10]
- Neon's PostgreSQL service[8]
Functionality
The unaccent extension provides a text search dictionary that removes accents from lexemes. It's particularly useful for:
- Making text searches accent-insensitive
- Ensuring that queries find relevant results regardless of accent variations
- Handling multilingual applications where users might not consistently use accents[8]
For example, using the unaccent function:
SELECT unaccent('Hôtel');Would return "Hotel" with the accent removed[2][5].
The latest stable version across all modern PostgreSQL implementations appears to be 1.1, with no indication of a newer version being available or in development as of June 2025.
Citations:
- 1: https://docs.aws.amazon.com/AmazonRDS/latest/PostgreSQLReleaseNotes/postgresql-extensions.html
- 2: https://www.postgresql.org/docs/current/unaccent.html
- 3: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/AuroraPostgreSQL.Extensions.html
- 4: https://learn.microsoft.com/en-us/azure/postgresql/extensions/concepts-extensions-versions
- 5: https://docs.geldata.com/reference/stdlib/pg_unaccent
- 6: https://cloud.google.com/sql/docs/postgres/release-notes
- 7: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.FeatureSupport.Extensions.html
- 8: https://neon.com/docs/extensions/unaccent
- 9: https://bucardo.org/postgres_all_versions.html
- 10: https://cloud.google.com/sql/docs/postgres/extensions
Extension version 1.1 is fully supported
The PostgreSQL “unaccent” extension (referenced here as
pg_unaccent
) remains at version 1.1 across PostgreSQL 14–17 and is supported by RDS, Aurora, Azure, GCP, Neon, etc. You can safely keepCREATE EXTENSION pg_unaccent VERSION '1.1';
as-is—the version is available and up-to-date.
No description provided.