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

sql: unaccent function #30540

Closed
verglor opened this issue Sep 23, 2018 · 3 comments
Closed

sql: unaccent function #30540

verglor opened this issue Sep 23, 2018 · 3 comments
Labels
A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community

Comments

@verglor
Copy link

verglor commented Sep 23, 2018

FEATURE REQUEST

Please implement PostgreSQL's unaccent() function.

@jordanlewis jordanlewis added A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community labels Sep 23, 2018
@knz
Copy link
Contributor

knz commented Oct 8, 2018

Note: This feature is conditional on supporting PostgreSQL's full text search features, a much larger project than just a SQL built-in function.

See #7821.

@bdarnell
Copy link
Contributor

bdarnell commented Oct 8, 2018

As a workaround for some use cases, the magic undocumented collations (cockroachdb/docs#1471) can be used instead. A "level1" collation performs accent-insensitive comparisons so a unique constraint on a column of this type will perform accent-insensitive duplicate checks, for example:

[email protected]:58318/defaultdb> create table t (s string collate en_u_ks_level1 primary key);
CREATE TABLE

Time: 4.625ms

[email protected]:58318/defaultdb> insert into t values ('hotel'::string collate en_u_ks_level1);
INSERT 1

Time: 3.332ms

[email protected]:58318/defaultdb> insert into t values ('hôtel'::string collate en_u_ks_level1);
pq: duplicate key value (s)=('hotel' COLLATE en_u_ks_level1) violates unique constraint "primary"

@jordanlewis
Copy link
Member

Closed by #54628. Thanks @mknycha!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) O-community Originated from the community
Projects
None yet
Development

No branches or pull requests

4 participants