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

ultranormalize_name function should strip trailing digits #17774

Open
samuelcolvin opened this issue Mar 14, 2025 · 1 comment
Open

ultranormalize_name function should strip trailing digits #17774

samuelcolvin opened this issue Mar 14, 2025 · 1 comment
Labels
feature request requires triaging maintainers need to do initial inspection of issue

Comments

@samuelcolvin
Copy link

What's the problem this feature will solve?

Users are able to create packages with extremely similar names by just appending a number, e.g. pydantic2.

Describe the solution you'd like

I'd like the ultranormalize_name function

CREATE FUNCTION ultranormalize_name(text) RETURNS text AS $$
SELECT lower(
regexp_replace(
regexp_replace(
regexp_replace($1, '(\.|_|-)', '', 'ig'),
'(l|L|i|I)', '1', 'ig'
),
'(o|O)', '0', 'ig'
)
)
$$
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;

to be extended to strip trailing digits when comparing names, so something like regexp_replace($1, '0+$', '').

Additional context

@samuelcolvin samuelcolvin added feature request requires triaging maintainers need to do initial inspection of issue labels Mar 14, 2025
@samuelcolvin
Copy link
Author

@di any thoughts on this? It seems important to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request requires triaging maintainers need to do initial inspection of issue
Projects
None yet
Development

No branches or pull requests

1 participant