You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow postgres version to be set statically #11372
Both database and searchSchema are only set in connect() when they are not defined, but queryRunner.getVersion() is always called.
Can the call to getVersion() also be changed to be similar to the other properties?
As this field is only used to determine if generated columns are supported, it can be trivially overwritten to reduce cold start time.
The Solution
This allows consumers of this library to set the version to avoid one extra query, which will reduce cold start time which is critical in serverless applications.
Considered Alternatives
N/A
Additional Context
No response
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
I like the idea, it seems like something we would want to expose and document as an option and support across all drivers.
Allowing users to set the database version and not looking it up also gives people an escape hatch if our version lookup doesn't work properly on their specific database type. For example, using a Postgres compatible db with the Postgres driver.
I agree with @mguida22. We should also cover MySQL and SAP drivers, as they also use the version property.
The TSDoc comments would need to be updated as well because the current description -Requires a SQL query to the DB, so it is not always set- would no longer be accurate.
We rely on the driver version in a quite some places, so PR #11373 will break the behavior that relies on that.
In #11376 (comment) I was suggesting to have some sort of lazy loading for the version. I think this is the only way to avoid loading the version on connect.
Activity
mguida22 commentedon Apr 2, 2025
I like the idea, it seems like something we would want to expose and document as an option and support across all drivers.
Allowing users to set the database version and not looking it up also gives people an escape hatch if our version lookup doesn't work properly on their specific database type. For example, using a Postgres compatible db with the Postgres driver.
@alumni what do you think?
jovanadjuric commentedon Apr 5, 2025
I agree with @mguida22. We should also cover MySQL and SAP drivers, as they also use the
versionproperty.The TSDoc comments would need to be updated as well because the current description -
Requires a SQL query to the DB, so it is not always set- would no longer be accurate.alumni commentedon Apr 6, 2025
We rely on the driver version in a quite some places, so PR #11373 will break the behavior that relies on that.
In #11376 (comment) I was suggesting to have some sort of lazy loading for the version. I think this is the only way to avoid loading the version on connect.
pkuczynski commentedon Nov 24, 2025
#11373 cant break anything as we already set the version