Skip to content

LSIF: Fix bad postgres connection default

Administrator requested to merge lsif-fix-bad-dbname-default into master

Created by: efritz

When doing a dogfooding run, @attfarhan ran into an issue where PGDATABASE was not set and the lsif-server and frontend/management-console connected to diffferent databases. It happens that he had both a sourcegraph as well as a farhan db with the schema migrations table. The farhan db was out of date and stopped the lsif-server from starting up.

It appears that if no dbname is explicitlty supplied that the Go/pg driver will default to the name of the user trying to connect, where typeorm/node-postgres will use the current OS user. This PR explicitly supplies a database name if one is not given so that it matches this behavior.

I've tried tracing both code paths down to the driver, but did not find a line I could refer to for this defaults. This changed is based on observable behavior only.

Merge request reports

Loading