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

Address/Prevent DB Strings With Leading, Trailing, or Multiple Consecutive Spaces #3432

Open
aaronskiba opened this issue Jun 28, 2024 · 0 comments

Comments

@aaronskiba
Copy link
Contributor

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

  • v4.1.1

Description

  • Throughout the db, there are many columns within many tables where strings start or end with a space, or have multiple consecutive spaces. To provide some examples, the following queries were performed on a May 2024 db dump from DMP Assistant's production environment:
SELECT COUNT(*)
FROM users
WHERE firstname LIKE ' %'
OR firstname LIKE '% '
OR surname LIKE ' %'
OR surname LIKE '% ';
-------------------------
count: 336
SELECT COUNT(*)
FROM orgs
WHERE name LIKE ' %'
OR name LIKE '% '
OR name LIKE '%  %'; -- more than one space
-------------------------
count: 12
SELECT COUNT(*)
FROM plans
WHERE title LIKE ' %'
OR title LIKE '% '
OR title LIKE '%  %'; -- more than one space 
-------------------------
count: 481

These extra spaces can lead to unwanted outcomes when executing search. The following is one example:

  • In the users table, there is an entry where firstname = "Susan " and surname = "Brown"
    Screenshot from 2024-06-28 10-44-19
    Screenshot from 2024-06-28 10-44-26

  • Searching "Susan Brown" (one space) returns no results:
    Screenshot from 2024-06-26 10-44-19

  • The query only works when "Susan Brown" (two spaces) is searched:
    Screenshot from 2024-06-26 10-45-00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant