Describe the bug
When there are dashes (-) in the Postgres username, the schematool fails with the following exception:
Running create-schemas task
2023-03-02 10:01:21.542 00000001 INFO forhealth.fhir.schema.app.Main Opening connection to: jdbc:postgresql://pg-albatross.databases:5432/polar_fhir_ibm
2023-03-02 10:01:22.186 00000001 INFO utils.postgres.PostgresAdapter The schema 'FHIR_ADMIN' is created or already exists
2023-03-02 10:01:22.189 00000001 INFO utils.postgres.PostgresAdapter The schema 'FHIRDATA' is created or already exists
2023-03-02 10:01:22.193 00000001 INFO utils.postgres.PostgresAdapter The schema 'FHIR_OAUTH' is created or already exists
2023-03-02 10:01:22.197 00000001 INFO utils.postgres.PostgresAdapter The schema 'FHIR_JBATCH' is created or already exists
2023-03-02 10:01:22.202 00000001 INFO forhealth.fhir.schema.app.Main Processing took: 0.673 s
2023-03-02 10:01:22.203 00000001 INFO forhealth.fhir.schema.app.Main SCHEMA CHANGE: OK
Running update-schema task
2023-03-02 10:01:22.934 00000001 SEVERE forhealth.fhir.schema.app.Main bad argument
Invalid SQL object name: 'my-user'
java.lang.IllegalArgumentException: Invalid SQL object name: 'my-user'
at org.linuxforhealth.fhir.database.utils.common.DataDefinitionUtil.assertValidName(DataDefinitionUtil.java:152)
at org.linuxforhealth.fhir.schema.app.Main.parseArgs(Main.java:1180)
at org.linuxforhealth.fhir.schema.app.Main.main(Main.java:2006)
Usage:
[...]
2023-03-02 10:01:23.062 00000001 SEVERE forhealth.fhir.schema.app.Main SCHEMA CHANGE: BAD ARGS
Expected behavior
The schematool should be able to connect to the database as usual.
Additional context
We are using Crunchy Postgres for Kubernetes to manage our databases. The operator cannot use _ in usernames, since it creates secrets containing them in their names (Kubernetes resource names must be DNS subdomain conformant). AFAIK, - in Postgres usernames are legal.
Describe the bug When there are dashes (
-
) in the Postgres username, the schematool fails with the following exception:Names seem to be verified against this pattern.
Environment Helm chart
lfh-helm/fhir-server:0.9.1
usingghcr.io/linuxforhealth/fhir-schematool:5.1.1
To Reproduce Execute in schematool container:
Expected behavior The schematool should be able to connect to the database as usual.
Additional context We are using Crunchy Postgres for Kubernetes to manage our databases. The operator cannot use
_
in usernames, since it creates secrets containing them in their names (Kubernetes resource names must be DNS subdomain conformant). AFAIK,-
in Postgres usernames are legal.