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

Database init error when locale is not english #729

Closed
TanguyBaudrin opened this issue Oct 19, 2020 · 0 comments · Fixed by #736
Closed

Database init error when locale is not english #729

TanguyBaudrin opened this issue Oct 19, 2020 · 0 comments · Fixed by #736
Assignees
Labels
bug Something isn't working

Comments

@TanguyBaudrin
Copy link

Hi,

When testing Boundary, I faced an issue during the init database.

After digging a while the script told me that the database was already initialized, so I started looking at the code, and found this :

case strings.Contains(err.Error(), "does not exist"):

My postgresql installation was not installed with an english locale (a french one), so the error message doesn't have the does not exist but the french equivalent n'existe pas

Maybe a good way to handle this would be to use an error code, not dependant of the locale ?

@TanguyBaudrin TanguyBaudrin changed the title Database init error when locale in not english Database init error when locale is not english Oct 19, 2020
@malnick malnick self-assigned this Oct 19, 2020
@malnick malnick added bug Something isn't working enhancement New feature or request and removed bug Something isn't working enhancement New feature or request labels Oct 19, 2020
@malnick malnick removed their assignment Oct 19, 2020
enmand added a commit to enmand/boundary that referenced this issue Oct 21, 2020
…ization

The check for schema_migrations uses a database/sql.QueryContext func, which returns
errors directly from the driver. In this case, check the error code from Postgres,
and if it matches 42P01 (the error code for table not found), run the initialization.

Downside here, is it's now checking a concrete error type from the database driver
in the command code. This could probably be abstracted away, in the case for other
database servers.

resolves hashicorp#729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants