mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 05:36:00 +00:00
fix analyser for cockroach
This commit is contained in:
@@ -162,9 +162,25 @@ const drivers = driverBases.map(driverBase => ({
|
||||
async getVersion(client) {
|
||||
const { rows } = await this.query(client, 'SELECT version()');
|
||||
const { version } = rows[0];
|
||||
|
||||
const isCockroach = version.toLowerCase().includes('cockroachdb');
|
||||
const isRedshift = version.toLowerCase().includes('redshift');
|
||||
const isPostgres = !isCockroach && !isRedshift;
|
||||
|
||||
const m = version.match(/([\d\.]+)/);
|
||||
let versionText = null;
|
||||
if (m) {
|
||||
if (isCockroach) versionText = `CockroachDB ${m[1]}`;
|
||||
if (isRedshift) versionText = `Redshift ${m[1]}`;
|
||||
if (isPostgres) versionText = `PostgreSQL ${m[1]}`;
|
||||
}
|
||||
|
||||
return {
|
||||
version,
|
||||
versionText: (version || '').replace(/\s*\(.*$/, ''),
|
||||
versionText,
|
||||
isPostgres,
|
||||
isCockroach,
|
||||
isRedshift,
|
||||
};
|
||||
},
|
||||
async readQuery(client, sql, structure) {
|
||||
|
||||
Reference in New Issue
Block a user