fix #9318 change postgres driver version checking query #9319
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Change Postgres driver version checking query to add compatibility with the Postgres compatible AWS Redshift database.
When connecting using the Postgres driver, the afterConnect method is running the SQL
SHOW server_version;
as part of feature support detection. This command works on postgres and cockroachdb, but is incompatible with the postgres compatible redshift database.This change adjusts the postgres
SHOW server_version
query to useSELECT version()
which is supported by Postgres and CockroachDB, and gives compatibility with AWS Redshift databaseExample command outputs:
Redshift
SELECT version();
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.40677
Postgresql
SELECT version();
PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
PostgreSQL 11.16 (Debian 11.16-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
SHOW server_version;
14.5 (Debian 14.5-1.pgdg110+1)
11.16 (Debian 11.16-1.pgdg90+1)
Fixes #9318
Pull-Request Checklist
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #0000