Skip to content

Conversation

@jobo-prod
Copy link
Contributor

Solves #4193

When there are dashes (-) in the Postgres username, the schematool fails with an exception. In Postgres, dashes are legal in usernames, so the verifying pattern is adapted accordingly.

When there are dashes (-) in the Postgres username, the schematool fails
with an exception. In Postgres, dashes are legal in usernames, so the
verifying pattern is adapted accordingly.

Signed-off-by: Bauer, Johannes <johannes.bauer@uk-erlangen.de>
*/
public class DataDefinitionUtil {
private static final String NAME_PATTERN_RGX = "[a-zA-Z_]\\w*$";
private static final String NAME_PATTERN_RGX = "[a-zA-Z_][-\\w]*$";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

today i learned that you can use an unescaped - to match within a character class if its the first (or last) char... i always escape these :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always just use regex101 for this 😄

Copy link
Member

@lmsurpre lmsurpre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lmsurpre lmsurpre merged commit 8429bf7 into LinuxForHealth:main May 17, 2023
lmsurpre added a commit that referenced this pull request May 17, 2023
Signed-off-by: Lee Surprenant <lmsurpre@merative.com>
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

Successfully merging this pull request may close these issues.

2 participants